I used the following code to draw a scatterplot. How to increase the font size and change colour of x-axis and y-axis label?
data=read.csv("data.csv")
plot(data$column1,data$column2,xlab="x axis", ylab="y axis", pch=19)
Look at ?par
for the various graphics parameters.
In general cex
controls size, col
controls colour. If you want to control the colour of a label, the par
is col.lab
, the colour of the axis annotations col.axis
, the colour of the main
text, col.main
etc. The names are quite intuitive, once you know where to begin.
For example
x <- 1:10
y <- 1:10
plot(x , y,xlab="x axis", ylab="y axis", pch=19, col.axis = 'blue', col.lab = 'red', cex.axis = 1.5, cex.lab = 2)
If you need to change the colour / style of the surrounding box and axis lines, then look at ?axis
or ?box
, and you will find that you will be using the same parameter names within calls to box
and axis.
You have a lot of control to make things however you wish.
eg
plot(x , y,xlab="x axis", ylab="y axis", pch=19, cex.lab = 2, axes = F,col.lab = 'red')
box(col = 'lightblue')
axis(1, col = 'blue', col.axis = 'purple', col.ticks = 'darkred', cex.axis = 1.5, font = 2, family = 'serif')
axis(2, col = 'maroon', col.axis = 'pink', col.ticks = 'limegreen', cex.axis = 0.9, font =3, family = 'mono')
Which is seriously ugly, but shows part of what you can control