我试图在下面的箱线图上增加状态标签的大小(勾选标签是/否)。
我做错了什么?
提前致谢。
status <- sample(c("yes", "no"), 50, replace=T)
value <- rnorm(50, mean = 5, sd = 3)
data <- melt(data.frame(status, value),measure.vars="value")
p <- ggplot ( data, aes(x=status, y=value) ) +
geom_boxplot(outlier.shape=10, outlier.size=4) +
geom_jitter(aes(colour=value), size=3, position = position_jitter(width = .3)) +
coord_flip() +
scale_colour_gradient(limits=c(min(data$value), max(data$value)),low="#0000FF", high="#FF0000") +
labs(title="Title",x="status", y="value", colour="value")
p + theme(plot.title = element_text(size = rel(5)),
axis.title.x =element_text(size=10)
)
p
答案 0 :(得分:1)
如果我理解你的问题,你需要使用axis.text而不是axis.title。
library(reshape2)
library(ggplot2)
status <- sample(c("yes", "no"), 50, replace=T)
value <- rnorm(50, mean = 5, sd = 3)
data <- melt(data.frame(status, value),measure.vars="value")
ggplot(data, aes(x=status, y=value)) +
geom_boxplot(, outlier.shape=10, outlier.size=4) +
geom_jitter(aes(colour=value), size=3, position = position_jitter(width = .3)) +
coord_flip() +
scale_colour_gradient(limits=c(min(data$value), max(data$value)),low="#0000FF", high="#FF0000") +
labs(title="Title",x="status", y="value", colour="value")+
theme(plot.title = element_text(size = rel(5)),
axis.text.y =element_text(size=20))