I have a box plot and want to make the values of the y-axis bold. I know how to make the y-axis title bold.
R plot() – Set X, Y Axes Labels To set labels for X and Y axes in R plot, call plot() function and along with the data to be plot, pass required string values for the X and Y axes labels to the “xlab” and “ylab” parameters respectively. By default X-axis label is set to “x”, and Y-axis label is set to “y”.
Changing axis labels To alter the labels on the axis, add the code +labs(y= "y axis name", x = "x axis name") to your line of basic ggplot code. Note: You can also use +labs(title = "Title") which is equivalent to ggtitle .
Go to the menu in RStudio and click on Tools and then Global Options. Select the Appearance tab on the left. Again buried in the middle of things is the font size. Change this to 14 or 16 to start with and see what it looks like.
We would need to use the argument of theme function as axis. title. y=element_text(angle=0)) and this will write the Y-axis title to horizontal but the position will be changed to top.
Use par
:
par(font.axis = 2) # 2 means 'bold'
boxplot(1:10)
An alternative way using axis
(proposed by @joran):
boxplot(1:10, yaxt = "n") # suppress y axis
axis(side = 2, font = 2) # 'side = 2' means y axis
You can reset to normal typeface using par(font.axis = 1)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With