I have a ggboxplot that looks like this:
I would like to change the x-axis ticks for the box plots to read "Uncontrolled Disease" and "Controlled Disease" instead of "Progressive" and "Stable". I've tried to use scale_x_discrete:
ggboxplot(inf, x = "DiseaseStatus", y = "log.IL-1RA",
color = "DiseaseStatus", palette = c("#00AFBB", "#E7B800"),
ylim = c(-2,8),
order = c("Progressive", "Stable"),
scale_x_discrete(labels = c("Uncontrolled Disease", "Controlled Disease")),
main = "IL-1RA",
ylab = "log lab value", xlab = "DiseaseStatus")
But I get this error:
Error in !is.null(facet.by) | combine :
operations are possible only for numeric, logical or complex types
What am I doing wrong? Is it possible to change the x-axis ticks?
CodePudding user response:
This should do the trick!
ggboxplot(inf, x = "DiseaseStatus", y = "log.IL-1RA",
color = "DiseaseStatus", palette = c("#00AFBB", "#E7B800"),
ylim = c(-2,8),
order = c("Progressive", "Stable"),
main = "IL-1RA",
ylab = "log lab value", xlab = "DiseaseStatus")
scale_x_discrete(labels = c("Uncontrolled Disease", "Controlled Disease"))
I used test data becuase I didnt have your data. This is the code I used
library(ggpubr)
data("ToothGrowth")
df <- ToothGrowth
ggboxplot(df, x = "dose", y = "len", width = 0.8)
scale_x_discrete(labels = c("Uncontrolled Disease", "Controlled Disease", "third variable"))