[R] Pie charts using plotGooglemaps

Jim Lemon jim at bitwrit.com.au
Wed Apr 16 12:17:49 CEST 2014


See inline

On 04/16/2014 08:13 PM, DrunkenPhD wrote:
> No nothing :((((
> I tried :
>  > hdf <- get_map(location = c(20.166065, 41.270679), zoom = 8, maptype
> = 'roadmap')
>  > sampledf<-read.table(text="x y City Village
>
> 19.9437314 40.7086377 120 425
> 20.2214171 41.4924336 1 1
> 20.0955891 39.9481364 4 4
> 20.9506636 40.6447347 10 15",header=TRUE)
> # make the graphics device high enough to hold Albania
> x11(height=10,width=5)
> # display the map upon which you want the pies

hdf <- get_map(location = c(20.166065, 41.270679), zoom = 8,
  maptype = 'roadmap')
ggmap(hdf, extent = 'device')
# I don't know if you have to do anything else here

> # display the pies
> library(plotrix)
> for(pp in 1:4) floating.pie(sampledf[pp,"x"],sampledf[pp,"y"],
> unlist(sampledf[pp,c("City","Village")]),radius=0.1)
>
> but pffff nothing
> What to do

Look at the documentation for ggmap (I don't have the package on my 
system, so I can't do it for you). Try par("usr") to see the coordinates 
of the plot.

Jim




More information about the R-help mailing list