[R-sig-eco] Fixing vertical and horizontal axes in R

Marcelino de la Cruz marcelino.delacruz at upm.es
Thu May 12 10:15:02 CEST 2016


Hi Margaret,

Did you try try setting the argument asp=1, e.g.:

image(xgrid,ygrid,zmeshR, asp=1, ...., etc


HTH,

Marcelino

El 12/05/2016 a las 7:55, Margaret Donald escribió:
> Thanks, Shane, but that is precisely my problem. The final graph will not
> be the default windows size and I want to
>     a) nominate the overall height & width, and
>     b) enforce the equal scales on the x and y axes.
>
> My code currently looks like this:
>
> # Generate image plot 2:
> #-----------------------
> fn <- "SpeciesRateLevels11F.jpg"
> jpeg(fn, width=600, height=700)
> zmeshR <- matrix(zmeshR,ng,ng)
> image(xgrid,ygrid,zmeshR,bty="l",xlab="Easting",ylab="Northing",
>       col=zz.colors,  xlim=c(xx1, xx2), ylim=c(yy1, yy2),
>       main="Estimated number of native species /.01 ha")
> points(x,y,col="red",cex=0.7)
> lines(Jboundary[,1],Jboundary[,2],col="black",lwd=2)
>
> b <- contourLines(xgrid,ygrid ,
>              zmeshR, nlevels=11,
>              levels = c(2, 4, 6, 8,10,12,14,16,18,20,22))
> for (i in 1:11){
>     lines(b[[i]], col="black", lwd=1)
> }
>
> Cheers,
> Margaret Donald
>
>
> On 12 May 2016 at 14:02, Shane Baylis <shane.m.baylis at gmail.com> wrote:
>
>> Hi Margaret,
>>
>> It sounds like you're after eqscplot(), in package MASS. The overall size
>> can be set as for any plot window, but note that if you scale the plot by
>> dragging the limits of the plot window (or similar), the plot will need to
>> be re-generated after scaling the window to ensure that equal-scale is
>> maintained.
>>
>> https://stat.ethz.ch/R-manual/R-devel/library/MASS/html/eqscplot.html
>>
>> Hope that helps,
>>
>>  Shane Baylis
>>
>> On 12/05/16 13:13, Margaret Donald wrote:
>>
>>> I have a figure which uses the same measurement units both vertically and
>>> horizontally. I need the interval representing 20 m to be identical for
>>> both the x and y axes.  How do I specify this? And at the same time
>>> dictate
>>> the size of the overall graph which is being saved as a jpeg.
>>>
>>>
>>> Regards,
>>> Margaret Donald
>>>
>>>
>>>
>>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>
>
>
>



More information about the R-sig-ecology mailing list