Ervan Rutishauser ervan.rutishau...@cirad.fr<mailto:ervan.rutishau...@cirad.fr> 
writes:

> I wonder how to resize a figure in spatstat, as it currently appears with 
> large
> margins (useless for me). I would like to enlarge my figure at maximum in
> the windows and optionally add some legend...



The plot commands in 'spatstat' call the basic R graphics package.

Use the graphics parameters in par() to control them.

To reduce margin size, use the parameters 'mar' and 'oma' in par()



To remove the maximum possible space outside the plot area,

      oldpar <- par(mar=rep(0,4), oma=rep(0,4))

      plot(X, main="")

      par(oldpar)

where 'X' is a spatstat object.



Many of the plots in spatstat use equal scales on the x and y axes, so if the 
object to be plotted does not have the same aspect ratio (height over width) as 
the plottable region, there will inevitably be some blank space. You can 
visualise this by re-sizing a graphics window to different shapes.



For plotting to a postscript file (etc) you would need to call postscript() 
with the arguments 'width' and 'height' set to appropriate values so that the 
plottable region has the same aspect ratio as the object. One way to do this 
automatically:



                         B <- as.rectangle(X)

                         R <- with(B, diff(yrange)/diff(xrange))

                         w <- 6

                         h <- round(R * w, 1)

                         postscript("X.eps", horizontal=FALSE, width=w, 
height=h)

                         ...





Adrian Baddeley

---

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to