Re: [R] asp and ylim

From: David Epstein <David.Epstein_at_warwick.ac.uk>
Date: Mon, 21 Jul 2008 14:32:47 +0100

A really great answer to my concerns! I'll get hold of the Paul Murrell book, and see how far I can get.

On 21 Jul, 2008, at 10:48, Martin Maechler wrote:
> Play around resizing your graphics window..
>
> This is very instructive, with an 'asp = .' using "traditional
> graphics" plot().
OK, but I don't know what you mean by "asp=.". Does this mean setting asp equal to NULL, or to a default setting?

> DE> Perhaps the best solution is to live with plot() as it
> DE> is. If I need the picture for a paper, I will export
> DE> data to Matlab or Mathematica or Illustrator, where I
> DE> can get the control I want.
>
> Hah, you must be kidding!

Change "kidding" to "frustrated"!

> For a "paper plot", e.g., pdf() as I'd recommend nowadays,
> you can set the device region by 'width' and 'height' ;
> and if you really want to use "traditional graphics" here, do
> something like
>
> ## modified by MM from David Epstein's original example
> myplot <- function(y, yb = mean(y), ylim = c(-1,1)) {
> ybarv <- rep.int(yb, length(y))
> x <- seq_along(y)
> plot(x,y, asp=1, xlab="position",ylab="ybar", type="n", ylim =
> ylim)
> abline(h = ybar)## instead of segments(x[1], ybar, x[ylength],
> ybar)
> segments(x, ybarv, x,y)
> points (x, ybarv, pch=21, bg="white")
> points (x, y, pch=19, col="black")
> invisible()
> }
>
I learned quite a few things from this code above.

> y <- c(1.21, 0.51, 0.14, 1.62, -0.8,
> 0.72, -1.71, 0.84, 0.02, -0.12)
>
> myplot(y)
>
> ## MM: setting device region so that ylim = c(-1,1) "about fits"
> pdf.do("asp-ex.pdf", height= 3.3, width=10)
> myplot(y)
> pdf.end()

  I cannot find the functions pdf.do and pdf.end. Are these part of some package that I need to load? Your package?

Thanks
David



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. Received on Mon 21 Jul 2008 - 13:39:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jul 2008 - 14:32:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive