change plot names r code example

Example 1: how to change the font of the xlab in plot in r

plot(x,main="Title",xlab="xlabel",ylab="ylabel",sub="subtitle",
	 cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5)

Example 2: change the font of the title in a plot in r

x<-1:10; y<-x*x
plot(x,y, main = "", xlab="", ylab="",
     col.axis="blue", type="l") 
title(main = "Main title", sub = "Sub-title",
      xlab = "X axis", ylab = "Y axis",
      cex.main = 2,   font.main= 4, col.main= "red",
      cex.sub = 0.75, font.sub = 3, col.sub = "green",
      col.lab ="darkblue"
      )

Tags:

R Example