[R] [R-sig-eco] How to create axes in arbitrary positions?

Ben Bolker bolker at ufl.edu
Sun Jan 3 17:26:23 CET 2010


  Dear Zongshan Li,

  I'm forwarding this back to r-help ... it's generally best to keep the
conversation going in public, so that (a) other people can chime in with
ideas and suggestions, (b) your question doesn't get lost if the
original respondent doesn't have time to deal with it, (c) the answers
are archived for future reference.

  Your example (I've attached it, hope it makes it through but it may
not) helps.  Here is a crude example approximately along the same lines.

> x = 1850:2000
> y1 = runif(length(x))+0.5
> y2=seq(0,100,length=length(x))
> plot(x,y1,ylim=c(0,1.5))
> library(Hmisc)
> ?subplot
> subplot({plot(x,y2,axes=FALSE); axis(side=4)},x=range(x),y=c(0,0.5))


-------- Original Message --------
Subject: 	Re: [R-sig-eco] How to create axes in arbitrary positions?
Date: 	Sat, 2 Jan 2010 07:31:51 -0500
From: 	Zongshan Li <zongshan_li at yahoo.com>
To: 	Bolker,Benjamin Michael <bolker at ufl.edu>
References: 	<831079.35547.qm at web114002.mail.gq1.yahoo.com>
<4B3E3C40.9010306 at ufl.edu>



Dear Ben Bolker:
            I appeciate your introducing functions very much for my
question, and I am glad that your kindly intention to give me further help.
            I guess the function layout might draw plots at the
specified locations, but i still be confused about the exact meaning of
parameter: mat
             layout(mat, widths = rep(1, ncol(mat)), heights = rep(1,
nrow(mat)), respect = FALSE)
             the attached jpg file is an example of the kind of
graphics, and would you like to give me some comments how to draw this
kind of graphics in R?
             Thanks, again.

Best regards,

ZongShan(Sat, January 2, 2010 )




------------------------------------------------------------------------
*From:* Ben Bolker <bolker at ufl.edu>

*Cc:* "r-sig-ecology at r-project.org" <r-sig-ecology at r-project.org>
*Sent:* Sat, January 2, 2010 2:17:36 AM
*Subject:* Re: [R-sig-eco] How to create axes in arbitrary positions?

  See ?layout, ?subplot in the Hmisc package; in the ?par help page, you
may also want to see "new", "mfrow", "mfcol".

  Not quite sure what you're asking (posting an example of the kind of
graphics you want to a web page somewhere is sometimes helpful) but
maybe this helps.

Zongshan Li wrote:
> Dear the friends of R-Ecology:
>      I am a beginner for R language, and I think my problem may be
very simple.
>    --------------------
>    Prior to use R, I used matlab to draw several plots of different
heights into one object.
>    The codes are that:
>      axes('position', [0.1,0.1,0.4,0.1]); plot……
>      axes('position', [0.1,0.2,0.4,0.2]); plot…….
>      axes('position', [0.1,0.4,0.4,0.3]); plot…….
>    I am wondering if there is some kind of function in R to draw plots
at the specified locations?
>  --------------------------- 
>     
>    Note: the following is the helping information of the function: axes. 
> 
>    AXES  Create axes in arbitrary positions.
>    AXES('position', RECT) opens up an axis at the specified location
>    and returns a handle to it.
>    RECT = [left, bottom, width, height] specifies the location and
>    size of the side of the axis box, relative to the lower-left
>    corner of the Figure window, in normalized units where (0,0)
>    is the lower-left corner and (1.0,1.0) is the upper-right.
> 
> 
> 
> Any help is strongly appreciated,
> thank you in advance,
> 
> ----------------------
> Zongshan, Li
> 2010-01-01
> Research Center for Eco-Environmental Sciences,Chinese Academy of Sciences
> Shuangqing Road, Haidian street, Beijing, 100085
> Tel: 86-10-13699145748
> QQ: 1141958023

> website: http://www.rcees.ac.cn/ 
>
>
>     
>     [[alternative HTML version deleted]]
>
>


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu <mailto:bolker at ufl.edu> / people.biology.ufl.edu/bolker
GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc



-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / people.biology.ufl.edu/bolker
GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100103/d6a4d128/attachment.bin>


More information about the R-help mailing list