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 -- View this message in context: http://www.nabble.com/Change-font-type-PNG-device-with-Lattice-xyplot-tp23272171p23272171.html Sent from the R help mailing list archive at Nabble.com.
RBlonk <robbert.blonk <at> gmail.com> writes:> 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!Thanks a lot for the nice example! There may be other ways, but I would do it as follows: -- Open R_HOME\etc\Rdevga -- Add the font you want as text at the end of the list -- Use font=18 (I may have miscounted) Dieter
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/