Visualize spatial data in R

This will be a short tutorial on how to do the following spatial plots.

Fig 1: House prices in Bern (Switzerland)

Working with spatial data means that you for each data point you have information on the specific location (e.g. longitude, latitude, city name). If you have this type of data available it will be easy for you do make nice plots. Spatial data is freely available online (cf. here).

Second, you will a map of a country as a spatial object. Spatial maps are freely available here. However, you don’t need to download the data manually – there is an easy way to access all information within R.

R example:

# you will need the following package

# download the map of switerland: level 3 means that you want to have all   # municipalities.
CH  <- getData("GADM",country="Switzerland",level=3)

# now you can just plot the map easily:

You can visualize your data also interactively (cf. here)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.