[R] arrow plots

Greg Snow Greg.Snow at imail.org
Tue Dec 8 21:42:20 CET 2009


You can use the grconvertX and/or grconvertY functions to help find the coordinates for your arrow (for plotting in the margin). 

-- 
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 Gavin Simpson
> Sent: Tuesday, December 08, 2009 11:57 AM
> To: Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
> Cc: r-help at r-project.org
> Subject: Re: [R] arrow plots
> 
> On Tue, 2009-12-08 at 13:42 -0500, Cable, Samuel B Civ USAF AFMC
> AFRL/RVBXI wrote:
> > Am doing some vector plots with the arrows() function.  Works well.
> But
> > what I need to do is supply an arrow for scaling for the reader.  I
> need
> > to plot an arrow of some known magnitude somewhere on the page
> > (preferably outside the bounds of the plot, so that it can be seen
> > clearly) with some text underneath it that says, for instance, "10
> > kg-m/sec".  Any ideas?  Thanks.
> 
> You can plot outside the plotting region using the 'xpd' plotting
> parameter:
> 
> plot(1:10, 1:10) ## dummy plot
> op <- par(xpd = TRUE) ## change clipping parameter & save defaults
> arrows(9, 10.75, 10, 10.75, length = 0.1) ## draw reference arrow
> text(9.5, 11,
>      labels = expression(10 ~ kg ~ m ~ sec^{"-1"})) ## add key
> par(op) ## reset plotting parameter defaults
> 
> You'll probably need to tweak the expression to get the units you
> wanted.
> 
> HTH
> 
> G
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
>  Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> 
> ______________________________________________
> 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