## Tech Blog 7: Plot a map with Eurostat NUTS2 regions in 7 easy steps

During our continued work on the C3S Energy project (a component of Copernicus Climate Change), we’ve been using Eurostat NUTS areas (nomenclature of territorial units for statistics) to define our European regions, both at country (NUTS0) and regional (NUTS2) levels.

Whilst there are plenty of resources available online for identifying the NUTS0 areas, there isn’t much out there detailing the NUTS2 regions and where they appear on a map.

After some research and experimentation at the behest of one of our colleagues, we were able to generate the resource here as a high resolution png file. Read on to find out how we did it.

#### How to show NUTS2 regions on a map

In this tutorial we will go though a workflow to produce a map with labelled regions. This should work for any geographic shapefiles.

Step one

Using Jupyter Notebooks, import the following packages:

[pastacode lang=”python” manual=”%23%20import%20packages%0Aimport%20geopandas%20as%20gpd%0Aimport%20matplotlib.pyplot%20as%20plt%0Afrom%20descartes%20import%20PolygonPatch%0Aimport%20shapefile%0Aimport%20cartopy.crs%20as%20ccrs%0Aimport%20cartopy.feature%20as%20cfeature%0Afrom%20matplotlib.offsetbox%20import%20AnchoredText” message=”” highlight=”” provider=”manual”/]

Step two

Load up your NUTS shapefile (obtain from eurostat)

Step three

The next piece of code defines a central point within each shape for labelling use

[pastacode lang=”python” manual=”%23%20use%20representitive_point%20method%20to%20obtain%20point%20from%20within%20each%20shapefile%0A%23%20creates%20new%20column%20’coords’%20containing%20the%20representitive%20points%0Anuts%5B’coords’%5D%20%3D%20nuts%5B’geometry’%5D.apply(lambda%20x%3A%20x.representative_point().coords%5B%3A%5D)%0Anuts%5B’coords’%5D%20%3D%20%5Bcoords%5B0%5D%20for%20coords%20in%20nuts%5B’coords’%5D%5D” message=”” highlight=”” provider=”manual”/]

Step four

Using matplotlib, plot the map.

And that’s it, we’ve plotted the NUTS2 regions!

But as you can see, it still needs some tweaking to make the regions clearer for the user.

Step five

Let’s first change the map x,y limits to focus on the EU domain.

Step six

Then Matplotlib can call the open source natural earth map resources for use as map elements (such as land/sea areas etc).

Step seven

Finally, looping through the central points in the shapefiles as defined earlier, gives us the labelling for each NUTS2 area.