0

Finally I found a nice way to visualize all the postal code areas of germany using the following code:

import json
import matplotlib.pyplot as plt 
from descartes import PolygonPatch

jfile = open('postal_code_areas.geojson', 'r')
jdata = json.load(jfile)
jfile.close()

fig = plt.figure()
ax = fig.gca()

for poly in jdata['features']:
    poly = poly['geometry']
    ax.add_patch(PolygonPatch(poly, fc='#6699cc', ec='#000000', alpha=0.5, zorder=2 ))

ax.axis('scaled')
plt.show()

Unfortunately the resulting image is not exactly what I was looking for:

enter image description here

First of all I don't understand why this looks so compressed?

I need a portable format of this image (like PNG) and I need to be able to zoom in order to investigate certain parts of the map (no colors applied yet, like e.g. birth rate or whatever per postal code area). What is the right way to do this?

user3182532
  • 1,097
  • 5
  • 22
  • 37
  • 1
    Matplotlib has standard zooming and panning tools available by default. What exactly is the problem of using them? – ImportanceOfBeingErnest Aug 24 '17 at 15:13
  • Did you wanted to use something like `ax.set_aspect('equal')` ? – Jan Kuiken Aug 24 '17 at 16:23
  • I need to export this image as PNG or PDF or whatever in order to hand it to my boss. she needs to be able to zoom in and out to see the details of the postal code areas. I cannot just tell her "here's the python code, you know what to do" :) I need something portable and zoomable. – user3182532 Aug 25 '17 at 08:38
  • does nobody know how to achieve this? – user3182532 Aug 25 '17 at 12:21

0 Answers0