[英]making y-axis labels bold in ggplot (x-axis is set bold but y-axis label doesn't change)
I am trying to set axis labels and ticks bold in ggplot but y-axis labels is not setting to bold. 我试图在ggplot中设置轴标签和刻度,但是y轴标签没有设置为粗体。 Please suggest what I should add to the script.
请建议我应该添加到脚本中。 Below is a reproducible example.
以下是可重复的示例。 I do need 'atop' command to set y-axis labels string as in the example below.
我需要'atop'命令来设置y轴标签字符串,如下例所示。
Thanks in advance. 提前致谢。
library(ggplot2)
chart <- ggplot(diamonds, aes(x = table, fill = clarity)) +
geom_histogram() +
scale_x_continuous('Month') +
scale_y_continuous(expression(atop('ET (W'~m^-2~')')))
chart<-chart+theme(axis.title.y = element_text(colour="grey20",size=20,face="bold"),
axis.text.x = element_text(colour="grey20",size=20,face="bold"),
axis.text.y = element_text(colour="grey20",size=20,face="bold"),
axis.title.x = element_text(colour="grey20",size=20,face="bold"))
print(chart)
I was having a similar problem and got this to work: 我有一个类似的问题,并让这个工作:
ylab(expression(atop(bold('ET (W'~m^-2~')'), paste(bold('something else'[here])))))
Hope that helps. 希望有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.