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

ggplotly breaks discrete x-axis with facet_yyyy in panels > 1 with only one category #1720

Closed
trekonom opened this issue Mar 10, 2020 · 0 comments · Fixed by #1788
Closed

Comments

@trekonom
Copy link
Contributor

trekonom commented Mar 10, 2020

ggplotly breaks a discrete axis with facet_yyyy when there is only one category present in a panel, except for the case that this happens to be the first panel. I stumbled over this bug based on a question on Stackoverflow:

library(plotly)

d <- data.frame(cat = c("A", "A", "A"), pan = paste("Panel", c(1, 2, 2)))
ggplot(d, aes(cat)) +
  geom_bar() +
  facet_wrap(~pan)

ggplotly()

facet-breaks-axis

Created on 2020-06-02 by the reprex package (v0.3.0)

@trekonom trekonom changed the title ggplotly breaks discrete x-axis with facet_yyyy and scales "free_x" when there is only one category a panel ggplotly breaks discrete x-axis with facet_yyyy in panels > 1 with only one category Jun 2, 2020
chschan pushed a commit to Displayr/plotly that referenced this issue Jun 22, 2020
* Fix bug in verify_attr. Closes issue plotly#1720.

* Add test to check that ggplotly does not break discrete x-axis in facet panels with only one category.

* Update tests/testthat/test-facet-axis.R

Co-authored-by: Carson Sievert <[email protected]>

* Add news item.

* Translate `\n` to `<br />` in fct labels, too (plotly#1700)

* Translate `\n` to `<br />` in fct labels, too

Before, this only worked for colums of type character.

* add @salim-b as ctb

* Add test for `translate_linebreaks()`

* remove superfluous char conversion

* change order of authors

* replace forcats code with base R

* add news item

Co-authored-by: Stefan Moog <[email protected]>
Co-authored-by: Carson Sievert <[email protected]>
Co-authored-by: Salim B <[email protected]>
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

Successfully merging a pull request may close this issue.

1 participant