[R] Contour Plot Aspect Ratio

Greg Snow Greg.Snow at imail.org
Fri Oct 3 17:40:35 CEST 2008


The squishplot function in the TeachingDemos package will adjust margins to give the desired aspect ratio with the whitespace outside of the plot rather than inside.  However the filled.contour function sets its own margins inside of the function so this does not work with filled.contour.  You could try it with the image function, or you may want to try using levelplot in the lattice package for another way to do filled contour plots that may work better for you.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Sam Albers
> Sent: Thursday, October 02, 2008 2:02 PM
> To: r-help at r-project.org
> Subject: [R] Contour Plot Aspect Ratio
>
> Hello there,
>
> I have a fairly simple request (I hope!)
>
> I have produced a filled contour plot like this:
>
> library(grDevices)
> library(gplots)
> library(plotrix)
>
> filled.contour(contour, axes=F, frame.plot=TRUE, color=terrain.colors,
> ylab=
> "Length Along Flume (m)", key.title = title(main="Velocity\n(m/s)"),
> key.axes = axis(4, seq(0, 0.6, by = 0.1)), asp=2, plot.axes = {
> axis.mult(side=1,mult=0.005,mult.label="Width (cm)")
> axis(side=2, at=x, labels=colnames(contour)) })
>
> Note the asp=2 argument.
>
> I would like to make this plot twice as long as it is wide. I
> accomplish
> this using asp=2 but the actual box that I am plotting now is too big
> for
> the data contained within.
>
> Here is what it looks like:
>
> http://docs.google.com/Doc?id=ddqdnxbq_30ffthshgk
>
> Does anyone know how I might be able to lengthen this graph without it
> looking like this? I want to suck in that vertical axes so that it is
> snug
> with the actual contour plot.
>
> Thanks in advance.
>
> Sam
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list