Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase font size of contour labels?

Tags:

plot

r

contour

I am trying to increase the font size of the contour plot labels in R. Currently, the contour plot labels are so small as to be unreadable!

Setting cex does not change the font size of the contour plot labels. Which parameter should I be setting?

model <- function (a, b){ 
    23.86+5.525*b-2.5725*a-6.6413*b^2-5.1862*a^2 
} 

x <- seq(-1, 1, 0.1) 
y <- seq(-1, 1, 0.1)
z <- outer(x, y ,model)

png('contour.png', width = 1000, height = 1000)
par(cex=3)
contour(x, y, z)
dev.off()

Output:

enter image description here

like image 204
I Like to Code Avatar asked Oct 30 '25 00:10

I Like to Code


1 Answers

Pass the labcex argument to contour with a desired scaling factor. As ?contour states, labcex is cex for contour labelling.

contour(x, y, z, labcex=5)

like image 172
gagolews Avatar answered Oct 31 '25 15:10

gagolews