erocoar / gghalves

✂️ Easy half-half geoms in ggplot2
https://erocoar.github.io/gghalves/
Other
241 stars 13 forks source link

Issues · erocoar/gghalves #20

Closed yangkai9999 closed 1 year ago

yangkai9999 commented 1 year ago

Hi Team, I was able to run the following testing code to get half/half plot on R 4.2.1 . But after I upgrade the R to 4.2.2, the last row of plot(hh) generate error messages:

Bin width defaults to 1/30 of the range of the data. Pick better value with binwidth. Error in geom_half_boxplot(): ! Problem while converting geom to grob. :information_source: Error occurred in the 1st layer. Caused by error in data.frame(): ! arguments imply differing number of rows: 1, 0 Run rlang::last_error() to see where the error occurred. Warning messages: 1: Removed 9 rows containing non-finite values (stat_boxplot()). 2: Removed 9 rows containing non-finite values (stat_half_bindot()).

the all packages in the code are all up to date. Does anyone know what the reason for the problem? and how to solve the problem? Thanks,

library(gghalves) library(tidyquant) library(tidyverse) library(gtsummary) library(ggplot2) mytest2 <- trial %>% filter( stage != "T1")

hh <- mytest2 %>%

ggplot(aes(grade, age, color = grade)) +

geom_half_boxplot(outlier.color = "red") + geom_half_dotplot( aes(fill =grade), dotsize = 0.75, stackratio = 0.5 , color = "black" ) +

scale_color_tq() + scale_fill_tq() + theme_tq() + labs( title = "", subtitl = "half-Boxplot + half-Dotplot" )

plot(hh)

erocoar commented 1 year ago

Thank you, gghalves 1.4.0 is now compatible with the new version of ggplot2 and the error should no longer occur !