Skip to content
Back to formatted view

Raw Message

Message-ID: <401D713F.1030605@stat.auckland.ac.nz>
Date: 2004-02-01T21:35:59Z
From: Paul Murrell
Subject: How to plot a small figure in a bigger one???

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/