[R] How to plot a small figure in a bigger one???

Paul Murrell p.murrell at auckland.ac.nz
Sun Feb 1 22:35:59 CET 2004


Hi


jzhang10 wrote:
> Hi,
> I want to insert a small figure into a bigger plot. I saw people are doing 
> this all the time, but I just could not figure out how to do it in R.
> Thanks for your help!
> Jinfeng Zhang


There are a number of ways to do this in R;  some pointers to get you 
started ...

(i)  par(new=TRUE) allows you to overlay several plots on the same page
(ii) par(fig) and par(plt) provide fine control over where a plot 
appears on a page
(iii) accurately locating subplots within a bigger plot may require some 
conversions between coordinate systems;  par("usr"), par("plt"), ... can 
be used to obtain information on current coordinate systems
(iv) you can have all the transformations done for you, by using the 
grid package to create viewports and the gridBase package to align them 
with a bigger plot - see the recent R News article "Integrating grid 
Graphics Output with Base Graphics Output" 
(http://cran.stat.auckland.ac.nz/doc/Rnews/Rnews_2003-2.pdf)

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list