plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

Integration with geom_phylopic()

Open TheAnalyticalEdge opened this issue 2 years ago • 0 comments

Hello,

When developing a shiny app for a data visualisation dashboard, I encountered an issue that geom_phylopic() isn't integrated with plotly yet. I have pasted the error below. Is there any plans to have this integrated? I (think I) have created a reprex showing two plots that work and the one with plotly with the error.

Thanks, Jo


geom_GeomPhylopic() has yet to be implemented in plotly. If you'd like to see this geom implemented, Please open an issue with your example code at https://github.com/ropensci/plotly/issues

library(rphylopic)
library(ggplot2)
library(plotly)
# get image from phylopic and set up df
silhouette.img <- get_phylopic(uuid = get_uuid(name = "Sphyrnidae", n=1)) # hammerhead
silhouette.df <- data.frame(x=1,  y=9)

# make some fake data
df = data.frame(x=c(1:10), 
                y=c(1:10))

# this plot works
p = ggplot() + 
  geom_point(data = df, aes(x=x, y=y)) + 
  theme_bw() + 
  # geom_phylopic(data = silhouette.df, aes(x = x, y = y), 
  #               size = 1, col='purple',
  #               img = silhouette.img) + 
  xlim(0,10)

p %>% ggplotly(tooltip = c("x"))

# this plot works
p = ggplot() + 
  geom_point(data = df, aes(x=x, y=y)) + 
  theme_bw() + 
  geom_phylopic(data = silhouette.df, aes(x = x, y = y),
                size = 1, col='purple',
                img = silhouette.img) +
  xlim(0,10)

p 

# this plot does not work
p = ggplot() + 
  geom_point(data = df, aes(x=x, y=y)) + 
  theme_bw() + 
  geom_phylopic(data = silhouette.df, aes(x = x, y = y),
                size = 1, col='purple',
                img = silhouette.img) +
  xlim(0,10)

p %>% ggplotly(tooltip = c("x"))

TheAnalyticalEdge avatar Nov 02 '23 22:11 TheAnalyticalEdge