[R] Change font type PNG device with Lattice xyplot
RBlonk
robbert.blonk at gmail.com
Wed Apr 29 08:20:46 CEST 2009
Thanks!
I found an other, less elegant, way as well. (This always happens, just
after asking someone else)
a<-data.frame(x=c(1:5),y=c(2,2,3,3,4))
require(lattice)
png(filename="let's change the font.png", width=480, height=300,
pointsize=12)
xyplot(y~x,data=a,
ylab=list("y-axis",font=6),
xlab=list("x-axis",font=6),
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),font=6),
type="l",lwd=3,lty=1,col=2)
dev.off()
But I prefer yours.
Regards
Robbert
Paul Murrell wrote:
>
> 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/
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Change-font-type-PNG-device-with-Lattice-xyplot-tp23272788p23291215.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list