kassambara / ggpubr

'ggplot2' Based Publication Ready Plots
https://rpkgs.datanovia.com/ggpubr/
1.13k stars 165 forks source link

scale_x_continuous() does not work on ggline() #395

Open phrenicooesophageale opened 3 years ago

phrenicooesophageale commented 3 years ago

Hello, I have an issue when trying to change the interval between the x-axis ticks in a ggline() lineplot. Both the ggplot() scale_x_continous() function and the ggpar() yticks.by= lead to the error "Discrete value supplied to continuous scale" even though both x any are numeric.

library(ggpubr) library(ggplot2) df <- ToothGrowth p <- ggline(df3, x = "dose", y = "len", color = "supp", add = c("mean_se"),

yticks.by = 12

   )+

scale_x_continuous(breaks = get_breaks(by = 2, from = 0)) p

I can bypass the error using ggplot() and geom_line but I would prefer to stay in the ggpubr environment.

Thanks in advance for any advice!

yassineMrabet commented 2 years ago

Hello Use numeric.x.axis = TRUE https://stackoverflow.com/questions/54220681/issues-with-continuous-x-axis-using-ggpubrlineplot