Font size change with theme() not working

2019-08-10 19:53发布

问题:

I am plotting barplots. I have written a script, however when I want to change the front size of the texts in the barplots, it does not work. For example, whether I write axis.text.y= element_text(size=6) or axis.text.y= element_text(size=15), I have the same text size. I don't know where the problem is in my script.

p <- ggplot(d, aes(x=treatment, y=value, fill=R2)) + geom_bar(stat = "identity", position="dodge")
p <- p + labs(list(title = "title", x = "xaxis", y = "yaxis"))
p <- p + scale_fill_manual(values=c(grey(0.4), grey(0.8)))
p <- p + theme(axis.text.x = element_text(size=6), axis.text.y= element_text(size=6), axis.title = element_text(size=6), title = element_text(size=4))
p <- p + geom_hline(aes(yintercept=100), lty=2)
p <- p + ylim(0,100)
p <- p + scale_x_discrete(limits=c('T','F','S', 'R'))#to reorder x axis
p <- p + theme_bw()
p <- p + theme(legend.position="none")
p
标签: r ggplot2