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
Paulo Justiniano Ribeiro Jr
2004-Jan-30 17:06 UTC
[R] How to plot a small figure in a bigger one???
Hi Zhang I've just done some "naive" things like that in geoR from which you may borrow some ideas Please have a look at examples in the documentation of the function coods2coords() and data gambia. Try: data(gambia) gambia.map() gambia.map You will need the geoR under development version 1.4-4 from: www.est.ufpr.br/geoR Cheers P.J. On Fri, 30 Jan 2004, 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 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >Paulo Justiniano Ribeiro Jr Departamento de Estat?stica Universidade Federal do Paran? Caixa Postal 19.081 CEP 81.531-990 Curitiba, PR - Brasil Tel: (+55) 41 361 3471 Fax: (+55) 41 361 3141 e-mail: pj at est.ufpr.br http://www.est.ufpr.br/~paulojus
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 ZhangThere 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/