John Doucette
John Doucette

Reputation: 4520

Increasing the size of axis labels in a Wireframe Plot

I want to adjust the size of the text in the axis labels of the wireframe method in R (found in the lattice package).

It seems like it should just be a matter of specifying

cex.lab=2

as is the case with most other plots. However, this does not increase the font size.

For example:

some_data <- expand.grid(c(1:10), c(1:10))
some_data$z <- sin(some_data$Var1 + some_data$Var2)
wireframe(z~Var1*Var2, some_data, scales=list(arrows=FALSE, cex=1.5), xlab='blah1', ylab='blah2', zlab='blah3')
wireframe(z~Var1*Var2, some_data, scales=list(arrows=FALSE, cex=1.5), xlab='blah1', ylab='blah2', zlab='blah3', cex.lab=4)

should produce a second plot with axis labels 4 times larger than the ones in the first. Instead they are identical.

Upvotes: 1

Views: 2604

Answers (1)

IRTFM
IRTFM

Reputation: 263301

Two ways, there might be others:

wireframe(z~Var1*Var2, some_data, 
            trellis.par.set(list(axis.text=list(cex=2))), 
            scales=list(arrows=FALSE), 
            xlab='blah1', ylab='blah2', zlab='blah3')

The canonical reference for this is Sarkar's "Lattice" text and this is described in the Parameter System chapter on pages 126-128.

It also appears that you can use nested arguments within scales. Drop the par.settings call and use this instead:

..., scales=list(arrows=FALSE, axis=list(text=list(cex=2))), ...

Upvotes: 3

Related Questions