Artur_Indio
Artur_Indio

Reputation: 766

How to change levelplot font family?

I need to change the text font family of levelplot graph, I trying this but no success:

levelplot(a,main=list(label="title",cex=1,fontfamily = "sans" ))

or

levelplot(a,main=list(label="title",cex=1,font = 3 )) 

Nothing change. I want to change for Times.

Thanks.

Upvotes: 0

Views: 2156

Answers (1)

MrFlick
MrFlick

Reputation: 206401

You can find a lot of those settings in the trellis.par.get() list. To override them for a specific plot with a par.settings parameter. Here an example using the test code from the levelplot page

x <- seq(pi/4, 5 * pi, length.out = 100)
y <- seq(pi/4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x^2, y^2, "+")))
grid <- expand.grid(x=x, y=y)
grid$z <- cos(r^2) * exp(-r/(pi^3))
levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
    ylab="", main="Weird Function", sub="with log scales",
    colorkey = FALSE, region = TRUE,
    par.settings=list(axis.text=list(fontfamily="serif"),
    par.xlab.text=list(fontfamily="serif"),
    par.ylab.text=list(fontfamily="serif"),
    par.main.text=list(fontfamily="serif"),
    par.sub.text=list(fontfamily="serif")
))

plot with serif font

Upvotes: 3

Related Questions