r-如何在ggplot2中增加轴标签和图例大小

  • 本文关键字:标签 增加 ggplot2 r ggplot2
  • 更新时间 :
  • 英文 :


我希望我的轴标签和图例看起来更大,并且我希望增加字体大小

我的代码:

ggplot(data.frame(x = c(-2, 2)), aes((x),xname ='wind') ) + stat_function(fun = dnorm, args = list(mean = -0.05116279, sd = 0.5725349), aes(colour = "1 hour")) +xlab("wind_speed_Error",cex.lab=1.5, cex.axis=1.5) + stat_function(fun=dnorm, args = list(mean = -0.355, sd = 0.6602059), aes(colour = "4 hour")) + scale_colour_manual("Predictions",values=c("blue","red"))

您可以使用theme访问titlelegend字体大小,如下所示。

library(ggplot2)
library(scales)
ggplot(data.frame(x = c(-2, 2)), aes((x), xname ="wind")) +
stat_function(fun = dnorm, args = list(mean = -0.05116279, sd = 0.5725349), aes(colour = "1 hour"))  +
stat_function(fun=dnorm, args = list(mean = -0.355, sd = 0.6602059),  aes(colour = "4 hour"))  +
scale_colour_manual("Predictions", values=c("blue","red")) +
xlab("wind_speed_Error") +
theme(axis.title.x = element_text(size = rel(1.5)),
legend.text = element_text(size = rel(1.5)),
legend.title = element_text(size = rel(1.5)))

最新更新