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

autoplot() legend removed by ggplotly() #394

Closed
AdamSpannbauer opened this issue Feb 6, 2024 · 3 comments
Closed

autoplot() legend removed by ggplotly() #394

AdamSpannbauer opened this issue Feb 6, 2024 · 3 comments

Comments

@AdamSpannbauer
Copy link

I realize this might be out of scope.

I find ggplotly() a great tool for quickly investigating irregularities via hover, and I like to encourage my students to use it; however, the autoplot() legends disappear in the conversion to plotly losing all value in cases of plotting multiple series.

My hunch is that this is due to the color mapping quosure ^interaction(___, sep = "/"). Can anyone provide insight into what's happening and/or how I might be able to overcome it?

library(fpp3)
library(plotly)

data("aus_production")

long_prod <- aus_production %>% 
  pivot_longer(-Quarter)

# Expected chart with legend
long_prod %>% 
  autoplot()

# Expected chart with no legend
long_prod %>% 
  autoplot() %>% 
  ggplotly()
@mitchelloharawild
Copy link
Member

I can't reproduce this with the latest versions of fabletools, plotly, and ggplot2. The legend still appears in the plotly output as it does with the ggplot2 plot. Perhaps try updating your packages? Let me know if this is still a problem after updating.

ggplot2
image

plotly
image

@AdamSpannbauer
Copy link
Author

@mitchelloharawild Can't believe I didn't think to do that. Works now on my end! Thanks!!

@mitchelloharawild
Copy link
Member

No worries, glad it worked out for you and it's nice to hear that you're using fable for teaching! 🚀

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

No branches or pull requests

2 participants