Pages Menu
TwitterRss
Categories Menu

Posted by on Mar 30, 2015 in R Spatial, Resources, Spatial Analysis, Visualisation | 9 comments

Mapping Flows in R

Mapping Flows in R

Last year I published the above graphic, which then got converted into the below for the book London: The Information Capital. I have had many requests for the code I used to create the plot so here it is! The data shown is the Office for National Statistics flow data. See here for the latest version. The file I used for the above can be downloaded here (it is >109 mb uncompressed so you need a decent computer to load/plot it all at once in R). You will also need this file of area (MSOA) codes and their co-ordinates. The code used is pasted below with comments above each segment. Good luck! library(plyr) library(ggplot2) library(maptools) Load the flow data required – origin and destination points are needed. See above for where you can get the table used here. input<-read.table("wu03ew_v1.csv", sep=",", header=T) We only need the first 3 columns of the above input names(input) The UK Census file above didn’t have coordinates just area codes. Here is a lookup that provides...

Read More

Posted by on Dec 9, 2013 in R Spatial, Resources, Spatial Analysis | 12 comments

Introduction to Spatial Data and ggplot2

Introduction to Spatial Data and ggplot2

For those starting out with spatial data in R, Robin Lovelace and I have prepared this tutorial (funded as part of the University of Leeds and UCL Talisman project). Here we introduce a range of analysis skills before demonstrating how you can deploy the powerful graphics capabilities of ggplot2 to visualise your results. There is also some “bonus” material at the end to show how you can use ggplot2 for descriptive statistics and so on. The tutorial covers: -Introduction to ggplot2 -Map projections -Adding Google and Stamen basemaps -Clipping and joining spatial data -Aggregating spatial data -ggplot2 for descriptive statistics Download the data you need from here. This is a work in progress so we may add improvements as time goes on. We also have a few more tutorials in the pipeline that will be posted here in due course.   [iframe src=”http://rpubs.com/RobinLovelace/intro-spatial” width=”100%”...

Read More

Posted by on Apr 8, 2013 in R Spatial, Resources, Spatial Analysis | 3 comments

Starting Analysis and Visualisation of Spatial Data with R

Starting Analysis and Visualisation of Spatial Data with R

Last week I ran an introductory workshop on the analysis and visualisation of spatial data with R. The software has become established as one of the best around for statistics and it is becoming increasingly recognised as a tool for data visualisation (I wrote about this last year, also see here) and spatial analysis. Interest in R is increasing all the time but many feel put off by its very steep learning curve. The help files are often complex and there are some slightly idiosyncratic aspects to the language you have use to get R to work. That said there is lot more help around on forums and some excellent introductory tutorials to get  you started. Here are a couple of worksheets I use to introduce the wonders of R. The first is written by Richard Harris from the University of Bristol. You can download the worksheet here and the example data from here. I like this worksheet because it is very applied (it is using a real dataset on an important problem), it gets you...

Read More

Posted by on Jun 7, 2012 in Featured Maps, R Spatial, Slideshow, Visualisation | 12 comments

Mapping the World’s Biggest Airlines

Mapping the World’s Biggest Airlines

The map above shows the routes flown by the top 7 airlines (by international passenger distance flown). The base map shows large urban areas and I have attempted to make it look a bit like the beautiful “Earth at Night” composite image produced by NASA. You can clearly see a relationship between where people live and where the big carriers fly to across Europe and the US but India and much of China have relatively few routes. I expect much of the slack is picked up by smaller airlines in these countries but they must represent key growth areas the world economy becomes increasingly driven by the east. This map isn’t meant to be comprehensive- I just wanted to make another example of a visualisation with ggplot2. How I did it Plotting great circles has become an increasingly popular thing to do with R (because they look cool) and the excellent flight path data freely available from the OpenFlights website provides a neat data source to play around with....

Read More

Posted by on Mar 30, 2012 in Featured Maps, R Spatial, Slideshow, Visualisation | 22 comments

Mapped: British, Spanish and Dutch Shipping 1750-1800

Mapped: British, Spanish and Dutch Shipping 1750-1800

I recently stumbled upon a fascinating dataset which contains digitised information from the log books of ships (mostly from Britain, France, Spain and The Netherlands) sailing between 1750 and 1850. The creation of this dataset was completed as part of the Climatological Database for the World’s Oceans 1750-1850 (CLIWOC) project. The routes are plotted from the lat/long positions derived from the ships’ logs. I have played around with the original data a little to clean it up (I removed routes where there was a gap of over 1000km between known points, and only mapped to the year 1800). As you can see the British (above) and Spanish and Dutch (below) had very different trading priorities over this period. What fascinates me most about these maps is the thousands (if not millions) of man hours required to create them. Today we churn out digital spatial information all the time without thinking, but for each set of coordinates contained in these maps a ship and her crew had to sail there and someone had...

Read More