Skip to content
Snippets Groups Projects

Resolve "REFAC: Map Plot for more subsets"

Merged Ghost User requested to merge lukas_issue227_refac_map-plot-for-more-subsets into develop
2 files
+ 17
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -124,6 +124,7 @@ class AbstractPlotClass:
return colors
@TimeTrackingWrapper
class PlotMonthlySummary(AbstractPlotClass):
"""
@@ -281,15 +282,17 @@ class PlotStationMap(AbstractPlotClass):
import cartopy.crs as ccrs
if generators is not None:
legend_elements = []
default_colors = self.get_dataset_colors()
for element in generators:
data_collection, plot_opts = self._get_collection_and_opts(element)
name = data_collection.name or "unknown"
marker = plot_opts.get("marker", "s")
ms = plot_opts.get("ms", 6)
mec = plot_opts.get("mec", "k")
mfc = plot_opts.get("mfc", "b")
name = data_collection.name or "unknown"
mfc = plot_opts.get("mfc", default_colors.get(name, "b"))
legend_elements.append(
mlines.Line2D([], [], mfc=mfc, mec=mec, marker=marker, ms=ms, linestyle='None', label=name))
mlines.Line2D([], [], mfc=mfc, mec=mec, marker=self._adjust_marker(marker), ms=ms, linestyle='None',
label=name))
for station in data_collection:
coords = station.get_coordinates()
IDx, IDy = coords["lon"], coords["lat"]
@@ -297,6 +300,14 @@ class PlotStationMap(AbstractPlotClass):
if len(legend_elements) > 0:
self._ax.legend(handles=legend_elements, loc='best')
@staticmethod
def _adjust_marker(marker):
_adjust = {4: "<", 5: ">", 6: "^", 7: "v", 8: "<", 9: ">", 10: "^", 11: "v"}
if isinstance(marker, int) and marker in _adjust.keys():
return _adjust[marker]
else:
return marker
@staticmethod
def _get_collection_and_opts(element):
if isinstance(element, tuple):
Loading