dynamicTick = TRUE returns error when the ggplot has a facet_grid function
Open
Nobody has claimed this yet.
bug
ggplotly
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
Package version: plotly - 4.7.1, ggplot - 3.0.0.9000
I need to use the dynamicTick = TRUE parameter of ggplotly so that the y axis scale can be updated automatically after zoom in/out. But it does not seem to work when I have a facet_grid component in the ggplot.
Here is a quick example:
## generate random data
x = c(rep("2010", n = 10), rep("2011", n = 10), rep("2012", n = 10), rep("2013", n = 10), rep("2014", n = 10))
y = c(rnorm(n = 50))
z = c(rep("A", n = 25), rep("B", n = 25))
df = data.frame("year" = x, "value" = y, "cat" = z, stringsAsFactors = FALSE)
## create ggplot
ggplot(data = df, aes(x = year, y = value)) +
geom_point(size = 2) +
facet_grid(~cat) +
theme_bw()
## ggplotly()
ggplotly(dynamicTicks = TRUE)
Any help or suggestions of workaround would be appreciated.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied R example with ggplotly and dynamicTicks enabled, then trace the handling of facet_grid plots and dynamic tick updates. Done means the faceted plot no longer errors and its y-axis scale updates after zooming in or out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100