[R] [R-sig-Geo] plot() and Jpeg() increase font size and resolution

Roger Bivand Roger.Bivand at nhh.no
Fri Nov 24 08:40:48 CET 2006


On Fri, 24 Nov 2006 Alexander.Herr at csiro.au wrote:

>  
> Dear list,
> 
> I am having troubles increasing the fontize when plotting a
> variogram{gstat} and its model (vgm) with plot and using jpeg(). Also
> the resolution in the jpeg call does not work. I am using R2.4 on
> Mandriva 10.2 linux.
> 
> I can change fontsize with cex.axis in a normal plot, so I presume it
> has to do with plotting the variogram model. Any help on how to increase
> the font size and resolution would be appreciated?

I believe that the underlying plot.gstatVariogram() method uses lattice 
graphics, not base graphics. So the problem is to find the right way of 
passing the parameter for xyplot(), and then see if plot.gstatVariogram() 
lets you do the same.

df <- data.frame(x=1:10, y=runif(10))
xyplot(y ~ x, df, scales=list(cex=3))

works, but

data(meuse)
vgm1 <- variogram(log(zinc)~1, ~x+y, meuse)
plot(vgm1, scales=list(cex=3))

unfortunately doesn't, so more exploration will be needed. I think the 
scales= argument is not passed through in the final brach to xyplot() in 
gstat:::plot.gstatVariogram(). From the examples:

plot(v, group.id = FALSE, auto.key = TRUE, scales=list(cex=2))

works, but

plot(vgm2, scales=list(cex=2))

doesn't.

Roger

> 
> R-calls:
> v1<-variogram(log(z)~x+y, loc=coordinates(shp1),data=shp1)
> m1<-vgm(0.0175, "Gau", 200000,0.052)
> 
> jpeg(file="LOTPLAN_variogram_mod.jpg", bg="white", res=300,
> pointsize=16, width=1200, height=1200, quality=100)
> 
>  plot(v1,plot.number=F, model=m1, ylim=c(0.04,0.08), col="black",
> cex.axis=1.5)
> 
> dev.off()
> 
> Thanks Herry
> 
> Dr Alexander Herr
> Spatial and statistical analyst
> CSIRO, Sustainable Ecosystems
> Davies Laboratory,
> University Drive, Douglas, QLD 4814 
> Private Mail Bag, Aitkenvale, QLD 4814
>  
> Phone/www 
> (07) 4753 8510; 4753 8650(fax)
> Home: http://herry.ausbats.org.au
> Webadmin ABS: http://ausbats.org.au
> Sustainable Ecosystems: http://www.cse.csiro.au/
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-help mailing list