3

I am trying to produce Choroplete maps using shapefiles and Data provided by Eurostat. The shapefile has been downloaded here: using JD Longs code from this post.

This is the minimal code to reproduce the figure I posted below.

library(maptools)
tmpdir <- tempdir()
url <- 'http://ec.europa.eu/eurostat/cache/GISCO/geodatafiles/NUTS_2010_03M_SH.zip'
file <- basename(url)
download.file(url, file)
unzip(file, exdir = tmpdir )
shapeFile <- paste(tmpdir,"/Shape/data/NUTS_RG_03M_2010", sep="")

EU <- readShapeSpatial(shapeFile)
plot(EU)

My problem is that I would like to have the plot area to focus on Europe only, but due to the Overseas regions (France and Spain), the plot does not have the right focus. Is there an easy way to "crop" the plot area in the above example?

The polygons I want to get rid of are are part of the "Country_Shape", so filtering them out is no option. I tried to achieve my goal by defining the xlim and ylim parameters in the plot command, but did not succeed. I used locator() to get the coordinates from the graphics device, but plugging the values in didn't provide the wanted results.

The minimal example

Community
  • 1
  • 1
Tungurahua
  • 489
  • 7
  • 21

1 Answers1

6

The shapefile projection file (Shape/data/NUTS_RG_03M_2010.prj) shows the following:

GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

The information contained in the .prj file specifies the geographic coordinate system of the geometric data in the Shapefile. Try appropriate coordinates for xlim and ylim for this coordinate system:

R> plot(EU, ylim=c(30, 70), xlim=c(-10, 44))
R> box()

plot example

rcs
  • 67,191
  • 22
  • 172
  • 153