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

ggplot2 extension packages #566

Open
3 of 27 tasks
cpsievert opened this issue Apr 28, 2016 · 22 comments
Open
3 of 27 tasks

ggplot2 extension packages #566

cpsievert opened this issue Apr 28, 2016 · 22 comments

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Apr 28, 2016

Extensions that we'd like ggplotly() to support

Extensions that ggplotly() currently supports

  • GGally
  • ggalluvial
  • ggalt

Extensions that we don't plan on working on anytime soon

Want to add an extension?

If any community members are interested in implementing a hook into ggplotly() for a custom geom, see https://cpsievert.github.io/plotly_book/translating-custom-ggplot2-geoms.html

If anyone would like to sponsor work on a specific geom/package, please get in touch.

@bsquire0128
Copy link

I am working in the forecast package right now and would really like to use Plotly for my dashboard! I have found the following links really helpful for converting forecast to ggplot2 :
http://robjhyndman.com/hyndsight/forecasts-and-ggplot/

http://davenportspatialanalytics.squarespace.com/blog/2012/3/14/plotting-forecast-objects-in-ggplot-part-1-extracting-the-da.html

http://davenportspatialanalytics.squarespace.com/blog/2012/3/21/plotting-forecast-objects-in-ggplot-part-2-visualize-observa.html

Although I will admit I think there is a bug with the geom_ribbon function in plotly. I can plot the ggplot perfectly with my prediction band, but the ggplotly interpretation of the ggplot2 is converting my NA's for the observed values into values for the geom_ribbon

ggplot2 image
image

ggplotly
image

@maxheld83
Copy link

can I just add a huge +1 for ggrepel support via plotly::ggplotly()?

The ggrepel repel-optimisation of course, wouldn't be available in pure JS.
Any chance it could be replicated in plotly?

Would be nice to have the repelled-labels resized/react to the size of the plots.

@jimjam-slam
Copy link

jimjam-slam commented Sep 11, 2017

I'm working on a hook for my fork of ggflags (which substitutes SVGs for the PNGs originally used). I'm trying to get my head around is_basic and geom2trace—in particular, how they fit into the broader plot conversion process and how much I can model one of them on, say, GeomPoint.

EDIT: also documenting as I work things out on Stack Overflow. Any expertise or guidance from people here would be appreciated, though!

@cpsievert
Copy link
Collaborator Author

I don't think plotly.js has the ability to accept arbitrary SVG/PNG for marker definitions...you might be able to leverage marker color gradients, but I'm not immediately sure.

Anyway, I remember having a look at ggflags and was thinking we could probably convert them in a similar way to annotation_raster(). Have a look at layers2layout() and let me know you have questions!

@jimjam-slam
Copy link

jimjam-slam commented Sep 14, 2017

Mmmm, I think I see how it works. The main problem I see is that geom_flag isn't an annotation. That means you'd have to manually evaluate its aesthetics to position and size it, and I don't think it would work with facets (I'm also guessing that annotations don't get hovertexts—is that correct?).

@cpsievert
Copy link
Collaborator Author

Annotations are raster objects -- that's also true for geom_flag, correct? If so, the implementation would be very similar (which works for facets)

@jimjam-slam
Copy link

jimjam-slam commented Sep 14, 2017

In the case of my fork of ggflags, I've switched to using SVGs in order to size them without blowing out file size. But my concern is less about the file format and more about associating the flags with the source dataset in the way that traces do. I don't want to just decorate the layout with flags; I'm interested in using them as actual points (or at least giving the user that impression).

@KasperSkytte
Copy link

Would be super awesome if geom_text_repel() would work with plotly since I mainly use plotly for plots totally crowded with text 👍

@flying-sheep
Copy link

apparently ggjoy is deprecated in favor of ggridges

@jas1
Copy link

jas1 commented Jun 3, 2018

will love to see ggraph implemented.

about the comment:
" treemapify (although, this seems to have significant overlap with ggraph) "
it means that i must choose one or the other ?
in case both get implemented and i want to use both ?

thanks in advance, and keep the awsome work :D !

@emmamaury
Copy link

Any chance geom_ma() from the tidyquant package will be implemented with ggplotly()?

@shashidhar22
Copy link

Any chance geom_stratum() and geom_alluvium() from the ggalluvial package be implemented with ggplotly soon?

@lozybean
Copy link

would you implement gggenes with ggplotly ?

@moutikabdessabour
Copy link
Contributor

@cpsievert can you rank the geoms by importance so I can try implementing them sequentially.

@cpsievert
Copy link
Collaborator Author

@moutikabdessabour here's some code to get weekly downloads over the past year for all the packages listed thus far. This pretty well reflects my priority list

library(dplyr)
library(cranlogs)
library(plotly)
downloads <- cran_downloads(
  package = c(
  "ggraph", "ggforce", "ggrepel", "ggtern", "tidybayes", "ggtree", "ggpolypath", "geomnet", "ggjoy", "ggflags", "forecast", "survminer", "tidyquant", "ggtheme", "treemapify", "directlabels", "ggsurv", "ggimage", "statebins", "ggpubr", "corrr", "ggpmisc", "ggnewscale", "Ipaper", "qqplotr", "ggpmisc"
), 
  from = Sys.Date() - 365, to = Sys.Date() - 1
)
downloadsTransformed <- downloads %>%
  mutate(count = zoo::rollapply(count, 7, sum, fill = NA))
plot_ly(downloadsTransformed, x = ~date, y = ~count, color = ~package) %>%
  add_lines() %>%
  config(displayModeBar = FALSE) %>%
  layout(hovermode = "x", yaxis = list(title = "Number of downloads"), xaxis = list(title = "", rangeslider = list(visible = TRUE), rangeselector = list(buttons = list(list(count = 1, label = "1m", step = "month", stepmode = "backward"), list(count = 12, label = "1yr", step = "month", stepmode = "backward"), list(step = "all")))))

Screen Shot 2021-11-02 at 4 04 53 PM

@flying-sheep
Copy link

As said, ggjoy has been superseded by ggridges, so you should count them together.

@cms72
Copy link

cms72 commented Mar 20, 2022

Can gggenomes be implemented in ggplotly? Thank you!

@aloboa
Copy link

aloboa commented Nov 5, 2022

When I try to use ggplotly(g1), where g1 is a ggplot using directlabels::geom_dl(), I get:
I get "geom_GeomDl() has yet to be implemented in plotly."

and no labels on the ggplotly plot.

Fully reported in
#1244 (comment)

but #1244 is closed...

@plotly plotly locked and limited conversation to collaborators Nov 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests