我正在使用ggplot2生成散点图.我把标题变成了变量,如何更改字体大小?代码如下:
library("ggplot2")
plotfunc <- function(x){
x +
geom_point() +
geom_smooth(se = FALSE, method = "lm", color = "blue", size = 1) +
opts(title = plottitle,
axis.title.x = theme_text(size = 8, colour = 'black'),
axis.title.y = theme_text(size = 8, colour = 'black', angle = 90))
}
plottitle <- "This is Title"
p <- ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width))
plotfunc(p)
Run Code Online (Sandbox Code Playgroud)
我试过了
opts(title = plottitle (size = 10),...
Run Code Online (Sandbox Code Playgroud)
但是有一个错误:
Error in opts(title = plottitle(size = 10),
axis.title.x = theme_text(size …Run Code Online (Sandbox Code Playgroud)