On Thu, Feb 27, 2014 at 12:20 PM, Lorenzo Isella <[email protected]> wrote: > Apologies for posting this to two different mailing lists, but I really need > some cross expertise. > I am trying to do the following: plot a geographical map colored according > to a scalar value (choropleth map) and to overimpose a network on the map. > To fix the ideas, you can imagine that I am plotting the GDP in different > countries (choropleth map) and the flow of payments among them (here is > where the network kicks in).
The code at the end of the email is a little too long for me to test it but as long as your map data is in lat lon, it should to be difficult to do what you want, and keep everything in lat lon. Basically you need map_data <- read.shp(...) map_data <- fortify(map_data) network_data <- read.table(...) # now both map_data and network_data have columns lat and lon # the question is really how your network data is formated. The best/easiest would be with 5 columns: startLon, startLat, endLon, endLat, amount ggplot() + geom_polygon(aes(x=lon, y=lat, fill=...), data=map_data) + geom_segment(aes(x=startLon, y=startLat, xend=endLon, yend=endLat, size=amount), data=network_data) Jean-Olivier Irisson — Université Pierre et Marie Curie Laboratoire d'Océanographie de Villefranche 181 Chemin du Lazaret 06230 Villefranche-sur-Mer Tel: +33 04 93 76 38 04 Mob: +33 06 21 05 19 90 http://www.obs-vlfr.fr/~irisson/ Send me large files at: http://www.obs-vlfr.fr/~irisson/upload/ _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
