[R] Change font type PNG device with Lattice xyplot
Paul Murrell
p.murrell at auckland.ac.nz
Tue Apr 28 22:53:49 CEST 2009
Hi
Here's one way ...
xyplot(y~x,data=a,
ylab="y-axis",
xlab="x-axis",
ylim=c(0,5),
par.settings=list(axis.line=list(lwd=1.5),
strip.border=list(lwd=2),
# This is the important bit
grid.pars=list(fontfamily="mono")),
scales=list(y=list(tick.number=5,tck=0.5)),
type="l",lwd=3,lty=1,col=2)
See ?windowsFonts for how to set up other fonts to use.
Paul
RBlonk wrote:
> Dear All,
> I have some problems with changing the default font (Arial) in a xyplot
> which is printed using the PNG-device. Although some things have been
> mentioned about this in the forum, I still couldn't figure it out. Can
> someone help me out?n Thanks in advance!
>
> I want to print the plot for pasting in Microsoft Word
> OS: Windows XP
>
> see example:
>
> a<-data.frame(x=c(1:5),y=c(2,2,3,3,4))
> png(filename="let's change the font.png", width=480, height=300,
> pointsize=12)
> xyplot(y~x,data=a,
> ylab="y-axis",
> xlab="x-axis",
> ylim=c(0,5),
> par.settings=list(axis.line=list(lwd=1.5),
> strip.border=list(lwd=2)),
> scales=list(y=list(tick.number=5,tck=0.5)),
> type="l",lwd=3,lty=1,col=2)
> dev.off()
>
> Robbert
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the R-help
mailing list