Hi, I wonder if it is possible with the graphics package to overlay one or several plots (barplots, for example) over a map. Data for the map is in a data frame with the latitude and longitude coordinates, and then:> plot(map$long, map$lat, type ="l")produces the map. I want to put each barplot in specific locations on the map, namely at the center of "statistical squares". I´ve seen an example in Paul Murrell´s "R Graphics" book that seems appropriate (grid package), but a bit complicated. Thanks a lot for any advice. Héctor -- Héctor Villalobos <hvillalo@ipn.mx> CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, MÉXICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 2425 Fax. (+52 612) 122 53 22 [[alternative HTML version deleted]]
Look at the subplot function in the TeachingDemos package. -----Original Message----- From: "H?ctor Villalobos" <hvillalo at ipn.mx> To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> Sent: 6/11/07 5:48 PM Subject: [R] barplot and map overlay Hi, I wonder if it is possible with the graphics package to overlay one or several plots (barplots, for example) over a map. Data for the map is in a data frame with the latitude and longitude coordinates, and then:> plot(map$long, map$lat, type ="l")produces the map. I want to put each barplot in specific locations on the map, namely at the center of "statistical squares". I?ve seen an example in Paul Murrell?s "R Graphics" book that seems appropriate (grid package), but a bit complicated. Thanks a lot for any advice. H?ctor -- H?ctor Villalobos <hvillalo at ipn.mx> CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, M?XICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 2425 Fax. (+52 612) 122 53 22 [[alternative HTML version deleted]]
Thank you Greg, It works! On 13 Jun 2007 at 8:27, Greg Snow wrote:> Look at the subplot function in the TeachingDemos package. > > -----Original Message----- > From: "H?ctor Villalobos" <hvillalo at ipn.mx> > To: "r-help at stat.math.ethz.ch" <r-help at stat.math.ethz.ch> > Sent: 6/11/07 5:48 PM > Subject: [R] barplot and map overlay > > Hi, > > I wonder if it is possible with the graphics package to overlay one or > several plots (barplots, for example) over a map. Data for the map is > in a data frame with the latitude and longitude coordinates, and then: > > > plot(map$long, map$lat, type ="l") > > produces the map. I want to put each barplot in specific locations on > the map, namely at the center of "statistical squares". > > I?ve seen an example in Paul Murrell?s "R Graphics" book that seems > appropriate (grid package), but a bit complicated. > > Thanks a lot for any advice. > > H?ctor-- H?ctor Villalobos <hvillalo at ipn.mx> CICIMAR - IPN A.P. 592. Col. Centro La Paz, Baja California Sur, M?XICO. 23000 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34 ext. 2425 Fax. (+52 612) 122 53 22