Skip to content
Back to formatted view

Raw Message

Message-ID: <6D794374-E2BB-4B8E-8A87-2CE8CBEB2E63@comcast.net>
Date: 2009-04-20T16:52:46Z
From: David Winsemius
Subject: How to force axis to have the same range
In-Reply-To: <loom.20090420T161804-756@post.gmane.org>

On Apr 20, 2009, at 12:18 PM, Dieter Menne wrote:

> Sebastien Bihorel <Sebastien.Bihorel <at> cognigencorp.com> writes:
>
>> I am trying to produce (standard and trellis) scatterplots which  
>> use the
>> same range of the x and y axes. In addition, I would like the plots  
>> to
>> be physically square. Is there one or more specific argument(s) to  
>> plot
>> and xyplot what would do that? I have looked at various  
>> combinations of
>> asp and pin value, but could not get what I wanted..
>
> In lattice : aspect = 1

To satisfy both of his requests with xyplot, I think he also needs  
xlim and ylim:

  xy <-data.frame(x=1:10, y= rnorm(10)+5)
  xyplot(y ~ x, data=xy, aspect=1)
  xyplot(y ~ x, data=xy, aspect=1, ylim=c(0,11), xlim=c(0,11))

I was less successful in using xlim and ylim with plot, since it seems  
to handle the x-axis differently than the y-axis as far as padding out  
beyond the limits. I would typically need to set asp=0.85 to get what  
looked to ba a square plot. Suggest reading the documentation for  
plot.window() as a start.

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT