Skip to content
Snippets Groups Projects
Commit 263db068 authored by felix kleinert's avatar felix kleinert
Browse files

Merge branch 'felix_issue108-map-plot-with-coordinates' into 'develop'

Resolve "map plot with coordinates"

See merge request toar/machinelearningtools!108
parents 76aaa9a7 a13618d6
Branches
No related tags found
3 merge requests!125Release v0.10.0,!124Update Master to new version v0.10.0,!108Resolve "map plot with coordinates"
Pipeline #39702 passed
......@@ -207,6 +207,7 @@ class PlotStationMap(AbstractPlotClass):
"""
super().__init__(plot_folder, "station_map")
self._ax = None
self._gl = None
self._plot(generators)
self._save()
......@@ -214,6 +215,9 @@ class PlotStationMap(AbstractPlotClass):
"""Draw coastline, lakes, ocean, rivers and country borders as background on the map."""
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"))
......@@ -251,11 +255,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._ax.set_extent([4, 17, 44, 58], crs=ccrs.PlateCarree())
self._gl = self._ax.gridlines(xlocs=range(0, 21, 5), ylocs=range(44, 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment