Use ggbreak
#158
Replies: 2 comments
-
|
Hey! The tidyplots package uses its own internal structure to manage plot components, which sometimes conflicts with ggbreak because ggbreak modifies the underlying ggplot object in a way that tidyplots might not expect during the add() call. To get them to work together, you should try converting the tidyplots object to a standard ggplot object first, then add the break. You can do this by calling the plotting function (like tidyplot()) and then using the + operator instead of add(): library(tidyplots)
library(ggbreak)
# Create the plot and convert to ggplot
p <- your_data %>%
tidyplot(x, y) %>%
add_mean_bar() # ... other tidyplots functions
# Now add the break using standard ggplot syntax
p + scale_y_break(c(3, 10))The add() function in tidyplots expects specific tidyplots components, while ggbreak functions return ggplot-compatible layers/scales that might work better with the standard + operator after the tidyplot object is initialized. |
Beta Was this translation helpful? Give feedback.
-
|
Dear @Zepeng-Mu For me this error appears with both It seems that Lets reproduce the error with plain ggplot2: Lets fix the error in tidyplots by freeing the dimensions: Thus, I fear that this can only be fixed by the Best |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I wonder if tidyplots can work with ggbreak.
I tried
add(ggbreak::scale_y_break(c(3, 10)))and gotThanks!
Beta Was this translation helpful? Give feedback.
All reactions