-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1788 from trekonom/fix-axis-facets
Fix axis facets
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
test_that("ggplotly does not break discrete x-axis with facet_yyyy in panels > 1 with only one category", { | ||
d <- data.frame(cat = c("A", "A", "A"), pan = paste("Panel", c(1, 2, 2))) | ||
gp <- ggplot(d, aes(cat)) + | ||
geom_bar() + | ||
facet_wrap(~pan) | ||
L <- plotly_build(ggplotly(gp)) | ||
# tickvals, ticktext and categoryarray have class 'AsIs' | ||
lapply(L$x$layout[c("xaxis", "xaxis2")], function(axis) { | ||
expect_s3_class(axis$tickvals, "AsIs") | ||
expect_s3_class(axis$ticktext, "AsIs") | ||
expect_true(axis$ticktext == "A") | ||
expect_s3_class(axis$categoryarray, "AsIs") | ||
expect_true(axis$categoryarray == "A") | ||
}) | ||
}) |