I Like to Code
I Like to Code

Reputation: 7251

How to increase font size of contour labels?

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

Upvotes: 4

Views: 5110

Answers (1)

gagolews
gagolews

Reputation: 13056

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)

Upvotes: 7

Related Questions