Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make the y-axis values bold in R?

Tags:

r

fonts

boxplot

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.

like image 345
user2679447 Avatar asked Jan 09 '14 18:01

user2679447


People also ask

How do you change the Y axis text in R?

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”.

How do I change axis labels in R?

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 .

How do I change the size of axis labels in R?

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.

How do you make the Y axis title horizontal R?

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.


1 Answers

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

enter image description here

You can reset to normal typeface using par(font.axis = 1).

like image 165
Sven Hohenstein Avatar answered Nov 15 '22 06:11

Sven Hohenstein