plotly / plotly/plotly.R

Integration with geom_phylopic()

Open
#2,313 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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"))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied R reprex with geom_phylopic() and ggplotly() to reproduce the unsupported-geom error. Read the existing ggplotly() handling for unsupported geoms and determine how this integration is tested. Done means the example renders through ggplotly() without the implementation error while retaining the plotted phylopic image and tooltip behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
plotly, r
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.