Making the y axis labels bold in ggplot (the x axis is bold, but the y axis label does not change)

I am trying to set the axis labels and bold in ggplot, but the y axis labels are not bold. Please suggest what should I add to the script. The following is a reproducible example. I need the β€œatop” command to set the y-axis label string, as in the example below.

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) 
+3
source share
1 answer

I had a similar problem and got this working:

 ylab(expression(atop(bold('ET (W'~m^-2~')'), paste(bold('something else'[here]))))) 

Hope this helps.

0
source

All Articles