eddy
eddy

Reputation: 103

Geopandas plot is streched

I'm trying to plot a state of Germany with geopandas. Unfortunately the plot is a bit streched.

import matplotlib.pyplot as plt
import geopandas as gpd

shapes = gpd.read_file('shapes.shp')
shapes.plot(figsize=(20,20), color='white', edgecolor='black')

If I execute the code above, I'll receive the following plot. enter image description here But if you compare the shape of the plot to the real shape of the state as displayed below, then this plot is a bit streched. enter image description here

I tried to adjust the axes and the figsize, but I didn't work.

Thanks for your help

Upvotes: 1

Views: 648

Answers (1)

eddy
eddy

Reputation: 103

As gboffi mentioned the projection is not right. So i changed it to EPSG:3857.

import matplotlib.pyplot as plt
import geopandas as gpd

shapes = gpd.read_file('shapes.shp').to_crs(epsg=3857)
fig, axs = plt.subplots(1, 1, figsize=(15,15))
shapes.plot(ax=axs, color='white', edgecolor='black')

enter image description here

Upvotes: 1

Related Questions