Matthew Hui
Matthew Hui

Reputation: 664

How to change the axis title font size of a `trellis` object?

I have a trellis object generated by a 3rd-party package. With that being said, I cannot change the attributes by re-creating another trellis object. I have to change its attributes after it has been created.

I have figured out which attributes control the axes' label font sizes, they are: my_trellis$x.scales$cex[1] and my_trellis$y.scales$cex[1]

But what about the axes' title font sizes? It took me some searches and still could not figure it out...

Thanks!

Upvotes: -2

Views: 960

Answers (1)

Artem
Artem

Reputation: 3414

You can change trellis object of lattice package by using trellis.par.get and trellis.par.set function as below:

library(lattice)
# simulation
data("quakes")
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
trellis <- xyplot(lat ~ long | Depth, data = quakes, main = "Large Font Title")


# change title font size
mt = trellis.par.get("par.main.text")
mt$cex = 2
trellis.par.set("par.main.text",mt)
trellis
class(trellis)

Output: library

Upvotes: 1

Related Questions