[R-sig-Geo] Overlay bubble chart on map

Tomislav Hengl hengl at spatial-analyst.net
Sun Aug 16 16:31:55 CEST 2009


Here is another example with overlay from the Reimann et al. (2008) book
(this uses a raster map as background - this if often more impressive):

http://www.statistik.tuwien.ac.at/StatDA/R-scripts/page151.html

The code is rather long, but it will give you good ideas what you have to do.

HTH

T. Hengl

> On Sun, Aug 16, 2009 at 12:20 PM, Rebecca
> Ross<rebecca.ross at plants.ox.ac.uk> wrote:
>>
>> Dear All,
>>
>> I am new to this list, so apologies if this question has been asked and
>> answered many times before!
>>
>> I would like to overlay a bubble chart onto a map so that the bubbles
>> correspond to particular points on the map. I have the shape file for
>> the map
>> and the lat long co-ordinates for the points. Could anyone tell me how
>> to put
>> the two together? The suggestions I found so far are plot.Map and
>> plot.Spatial,
>> neither of which work.
>>
>> I am working to a bit of a deadline, so a response today would be really
>> helpful.
>
> To read foo.shp:
>
> install.packages("rgdal")
>
> require(rgdal)
> map = readOGR("/path/to/maps/","foo")
> plot(map)
>
> then you can do:
>
> points(p$x,p$y)
>
>  or whatever to overlay on it. If a 'bubble chart' is just points
> scaled by some factor, you can either use the 'symbols' function in R
> or use pch and cex options to plot - with something like:
>
> p = data.frame(x=1:10,y=1:10,size=1:10)
> plot(p$x,p$y,pch=19,cex=p$size)
>
>  hope that helps!
>
> Barry
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list