Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package not working in ggplot call/Image not showing up #108

Closed
tungxphung opened this issue Aug 28, 2024 · 2 comments
Closed

Package not working in ggplot call/Image not showing up #108

tungxphung opened this issue Aug 28, 2024 · 2 comments
Assignees
Labels

Comments

@tungxphung
Copy link

Hello, I am trying to use rphylopic but for some reason it is not showing up in the plot (by ggplot2) at all. I am simply copying and pasting the Iris example in the introduction vignette. R takes a few seconds to load the image and work on the ggplot call but then only the points show up and there's simply no image. Saving the file also didn't help.

ggplot(iris) +
add_phylopic(x = 6.1, y = 3.2, img = img, alpha = 0.2) +
geom_point(aes(x = Sepal.Length, y = Sepal.Width))

However, the image shows up when added to the plot created by base plot()

plot(x = 1, y = 1, type = "n")
add_phylopic_base(img = img, x = 1.25, y = 1.25, ysize = 0.25)

I am using R/Rstudio 4.3.1. and have only rphylopic and ggplot2 loaded. Any chance you are aware of display issues with ggplot2?

Screenshot 2024-08-28 at 11 20 09 AM
@LewisAJones
Copy link
Collaborator

Hi @tungxphung, this does seem to be a bug that has creeped in with our latest release. It seems to be an issue with the automatic sizing of the silhouette. If you set ysize to a large value, you will see it is actually being plotted.

library(ggplot2)
library(rphylopic)
ggplot(iris) +
  add_phylopic(x = 6.1, y = 3.2, name = "Iris", alpha = 0.2, ysize = 500) +
  geom_point(aes(x = Sepal.Length, y = Sepal.Width))

image

But there seems to also be an issue with the silhouette being plotted upside down, which also needs fixing. For now you can do this by specifying angle.

library(ggplot2)
library(rphylopic)
ggplot(iris) +
  add_phylopic(x = 6.1, y = 3.2, name = "Iris", alpha = 0.2, 
               ysize = 500, angle = 180) +
  geom_point(aes(x = Sepal.Length, y = Sepal.Width))

image

We are both currently in the middle of moving house but we will look into this next week.

Thanks for bringing it to our attention!

@willgearty
Copy link
Collaborator

willgearty commented Sep 3, 2024

Hi @tungxphung, this is now resolved in the development version of rphylopic on GitHub. If you install the development version, everything should work properly:

install.packages("remotes")
remotes::install_github("palaeoverse/rphylopic")

I'll be submitting a new version to CRAN soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants