我正在使用R中的数据OrschardSprays。我只是使用下一条命令创建了箱形图
bp <- ggplot(OrchardSprays) +
geom_boxplot(mapping=aes(x=colpos,y=decrease, group=rowpos)) +
ggtitle("Decrease per column") +
ylab("Decreased volume in ml") +
xlab("No. of column")
问题是x轴未将图的框与“列”的数量相对应地分配。...x轴上的数字与列数不匹配:
这是我尝试过的。
bp + scale_x_continuous(breaks = )),(labels=c("1", "2", "3", "4", "5", "6", "7", "8")))
bp + scale_x_continuous(breaks = round(seq(min(OrchardSprays$colpos),
max(OrchardSprays$colpos),
by = 1)))
oRCHARDLABS <- c("1", "2", "3", "4", "5", "6", "7", "8")
bp + scale_x_discrete(labels= oRCHARDLABS)
提前谢谢