r - bars to be plotted over map part2 -


hello want plot bar on map

dataset <-dataframe(country, column1,column2,column3) 

i put code 'luke' put on blog in 2014 not working. have message:

error in par(plt = c(xyx, xyy), new = true) : invalid value specified graphical parameter "plt"

my code:

library(rworldmap) library(sp) library(methods) library(teachingdemos) require(sp) require(methods) ddf=dataset spdf <- joincountrydata2map(ddf , joincode = "name" , namejoincolumn = "country" , verbose = true) plot(getmap()) df <- merge(x=ddf, y=spdf@data[spdf@data$admin, c("admin", "lon", "lat")], by.x="country", by.y="admin", all.x=true) require(teachingdemos) (i in 1:nrow(df))    subplot(barplot(height=as.numeric(as.character(unlist(df[i, 2:4], use.names=f))),                    axes=f,                    col=rainbow(3), ylim=range(df[,2:4])),           x=df[i, 'lon'], y=df[i, 'lat'], size=c(.3, .3)) legend("topright", legend=names(df[, 2:4]), fill=rainbow(3)) 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -