From 83d920ebfb020204224aa44e57904a80930e1c39 Mon Sep 17 00:00:00 2001 From: Felix Kleinert <f.kleinert@fz-juelich.de> Date: Mon, 25 May 2020 08:15:10 +0200 Subject: [PATCH] add lat/lon ticks to map plot --- src/plotting/postprocessing_plotting.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plotting/postprocessing_plotting.py b/src/plotting/postprocessing_plotting.py index 4fcb1f49..ca3f3aa2 100644 --- a/src/plotting/postprocessing_plotting.py +++ b/src/plotting/postprocessing_plotting.py @@ -146,6 +146,7 @@ class PlotStationMap(AbstractPlotClass): """ super().__init__(plot_folder, "station_map") self._ax = None + self._gl = None self._plot(generators) self._save() @@ -155,6 +156,9 @@ class PlotStationMap(AbstractPlotClass): """ import cartopy.feature as cfeature + + self._ax.add_feature(cfeature.LAND.with_scale("50m")) + self._ax.natural_earth_shp(resolution='50m') self._ax.add_feature(cfeature.COASTLINE.with_scale("50m"), edgecolor='black') self._ax.add_feature(cfeature.LAKES.with_scale("50m")) self._ax.add_feature(cfeature.OCEAN.with_scale("50m")) @@ -187,11 +191,16 @@ class PlotStationMap(AbstractPlotClass): """ import cartopy.crs as ccrs + from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER fig = plt.figure(figsize=(10, 5)) self._ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) self._ax.set_extent([0, 20, 42, 58], crs=ccrs.PlateCarree()) + self._gl = self._ax.gridlines(xlocs=range(0, 21, 5), ylocs=range(42, 59, 2), draw_labels=True) + self._gl.xformatter = LONGITUDE_FORMATTER + self._gl.yformatter = LATITUDE_FORMATTER self._draw_background() self._plot_stations(generators) + plt.tight_layout() @TimeTrackingWrapper -- GitLab