From 7f4f7062686478b25178b37355bbddebab737d1e Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Tue, 2 Apr 2024 15:49:02 -0400 Subject: [PATCH 01/10] fixes in hatchmap and scattermap --- docs/notebooks/figanos_multiplots.ipynb | 6 +- figanos/matplotlib/plot.py | 75 +++++++++++++++---------- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/docs/notebooks/figanos_multiplots.ipynb b/docs/notebooks/figanos_multiplots.ipynb index 09a94acf..97cc7d4c 100644 --- a/docs/notebooks/figanos_multiplots.ipynb +++ b/docs/notebooks/figanos_multiplots.ipynb @@ -180,13 +180,13 @@ "im = fg.hatchmap({'sup_305k': sup_305k, 'inf_300k': inf_300k},\n", " plot_kw={\n", " 'sup_305k': {\n", - " 'hatches': '*',\n", + " 'hatches': ['////'], # hatches must be passed as a list\n", " 'col': 'time',\n", " \"x\": \"lon\",\n", " \"y\": \"lat\"\n", " },\n", " 'inf_300k': {\n", - " 'hatches': 'x',\n", + " 'hatches': ['**'],\n", " 'col': 'time',\n", " \"x\": \"lon\",\n", " \"y\": \"lat\"\n", @@ -196,7 +196,7 @@ " frame = True,\n", " legend_kw = {'title': 'Ensemble change'})\n", "\n", - "im.fig.suptitle(\"Multiple hatchmaps\", y=1.08)\n" + "im.fig.suptitle(\"Multiple hatchmaps\", y=1.08)" ] }, { diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index 0d20c178..0b112ff0 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1487,7 +1487,7 @@ def scattermap( If int or float, becomes center of cmap. Default center is 0. legend_kw : dict, optional Arguments to pass to plt.legend(). Some defaults {"loc": "lower left", "facecolor": "w", "framealpha": 1, - "edgecolor": "w", "bbox_to_anchor": (-0.05, 0)} + "edgecolors": "w", "bbox_to_anchor": (-0.05, 0)} show_time : bool, tuple, string or int. If True, show time (as date) at the bottom right of the figure. Can be a tuple of axis coordinates (0 to 1, as a fraction of the axis length) representing the location @@ -1627,6 +1627,15 @@ def scattermap( f"{len(mask) - np.sum(mask)} nan values were dropped when plotting the color values" ) + # set 'edgecolors' to the same value for all points to avoid plotting edges when np.nan + if ( + "edgecolors" in plot_kw + and matplotlib.colors.is_color_like(plot_kw["edgecolors"]) + and len(plot_kw["edgecolors"]) != len(plot_data.values) + ): + plot_kw["edgecolors"] = np.repeat(plot_kw["edgecolors"], len(plot_data.values)) + # plot_kw["edgecolors"] = [plot_kw["edgecolors"] if value else "none" for value in mask] + # point sizes if sizes: if sizes is True: @@ -1679,7 +1688,7 @@ def scattermap( "transform": transform, "zorder": 8, "marker": "o", - "edgecolor": "none", + "edgecolors": "none", } | plot_kw plot_kw_pop = plot_kw.copy() @@ -2056,7 +2065,7 @@ def hatchmap( features: list[str] | dict[str, dict[str, Any]] | None = None, geometries_kw: dict[str, Any] | None = None, levels: int | None = None, - legend_kw: dict[str, Any] | None = None, + legend_kw: dict[str, Any] | bool = True, show_time: bool | str | int | tuple[float, float] = False, frame: bool = False, ) -> matplotlib.axes.Axes: @@ -2087,8 +2096,8 @@ def hatchmap( cartopy.feature: ['coastline', 'borders', 'lakes', 'land', 'ocean', 'rivers', 'states']. geometries_kw : dict, optional Arguments passed to cartopy ax.add_geometry() which adds given geometries (GeoDataFrame geometry) to axis. - legend_kw : dict, optional - Arguments to pass to `ax.legend()`. + legend_kw : dict or boolean optional + Arguments to pass to `ax.legend()`. No legend is added if legend_kw == False. show_time : bool, tuple, string or int. If True, show time (as date) at the bottom right of the figure. Can be a tuple of axis coordinates (0 to 1, as a fraction of the axis length) representing the location @@ -2148,14 +2157,16 @@ def hatchmap( dattrs = None plot_data = {} - dc = plot_kw.copy() + dc = copy.deepcopy( + plot_kw + ) # make sure nested dict is not changed outside this function # convert data to dict (if not one) if not isinstance(data, dict): if isinstance(data, xr.DataArray): plot_data = {data.name: data} - if list(data.keys())[0] not in plot_kw.keys(): - plot_kw = {list(plot_data.keys())[0]: dc} + if data.name not in plot_kw.keys(): + plot_kw = {data.name: dc} elif isinstance(data, xr.Dataset): dattrs = data plot_data = {var: data[var] for var in data.data_vars} @@ -2187,28 +2198,25 @@ def hatchmap( if transform and ( "xlim" in list(plot_kw.values())[0] and "ylim" in list(plot_kw.values())[0] ): - extend = [ + extent = [ list(plot_kw.values())[0]["xlim"][0], list(plot_kw.values())[0]["xlim"][1], list(plot_kw.values())[0]["ylim"][0], list(plot_kw.values())[0]["ylim"][1], ] - {v.pop("xlim") for v in plot_kw.values()} - {v.pop("ylim") for v in plot_kw.values()} + [v.pop(lim) for lim in ["xlim", "ylim"] for v in plot_kw.values() if lim in v] elif transform and ( "xlim" in list(plot_kw.values())[0] or "ylim" in list(plot_kw.values())[0] ): - extend = None + extent = None warnings.warn( "Requires both xlim and ylim with 'transform'. Xlim or ylim was dropped" ) - if "xlim" in list(plot_kw.values())[0].keys(): - {v.pop("xlim") for v in plot_kw.values()} - if "ylim" in list(plot_kw.values())[0].keys(): - {v.pop("ylim") for v in plot_kw.values()} + [v.pop(lim) for lim in ["xlim", "ylim"] for v in plot_kw.values() if lim in v] + else: - extend = None + extent = None # setup fig, ax if ax is None and ( @@ -2222,11 +2230,11 @@ def hatchmap( ): raise ValueError("Cannot use 'ax' and 'col'/'row' at the same time.") elif ax is None: - { + [ v.setdefault("subplot_kws", {}).setdefault("projection", projection) for v in plot_kw.values() - } - cfig_kw = fig_kw.copy() + ] + cfig_kw = copy.deepcopy(fig_kw) if "figsize" in fig_kw: # add figsize to plot_kw for facetgrid plot_kw[0].setdefault("figsize", fig_kw["figsize"]) cfig_kw.pop("figsize") @@ -2274,9 +2282,9 @@ def hatchmap( im = v.where(mask is not True).plot.contourf(**plot_kw[k]) artists, labels = im.legend_elements(str_format="{:2.1f}".format) - if ax: + if ax and legend_kw: ax.legend(artists, labels, **legend_kw) - else: + elif legend_kw: im.figlegend = im.fig.legend(**legend_kw) elif len(plot_data) > 1 and "levels" in plot_kw[k]: @@ -2290,6 +2298,13 @@ def hatchmap( if "hatches" not in plot_kw[k].keys(): plot_kw[k]["hatches"] = dfh[n] n += 1 + elif isinstance( + plot_kw[k]["hatches"], str + ): # make sure the hatches are in a list + warnings.warn( + "Hatches argument must be of type 'list'. Wrapping string argument as list." + ) + plot_kw[k]["hatches"] = [plot_kw[k]["hatches"]] plot_kw[k].setdefault("transform", transform) if ax: @@ -2323,31 +2338,31 @@ def hatchmap( geometries_kw, frame, ) - if extend: - fax.set_extent(extend) + if extent: + fax.set_extent(extent) pat_leg.append( matplotlib.patches.Patch( - hatch=plot_kw[k]["hatches"], fill=False, label=k + hatch=plot_kw[k]["hatches"][0], fill=False, label=k ) ) - if pat_leg: + if pat_leg and legend_kw: legend_kw = { "loc": "lower right", "handleheight": 2, "handlelength": 4, } | legend_kw - if ax: + if ax and legend_kw: ax.legend(handles=pat_leg, **legend_kw) - else: + elif legend_kw: im.figlegend = im.fig.legend(handles=pat_leg, **legend_kw) # add features if ax: - if extend: - ax.set_extend(extend) + if extent: + ax.set_extent(extent) if dattrs: use_attrs.setdefault("title", "description") From 16178c6c28fa78f0930f555239d7c79481fa589c Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Wed, 17 Apr 2024 14:27:20 -0400 Subject: [PATCH 02/10] update docs --- figanos/matplotlib/plot.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index d952ee9e..a0daca45 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1627,14 +1627,14 @@ def scattermap( f"{len(mask) - np.sum(mask)} nan values were dropped when plotting the color values" ) - # set 'edgecolors' to the same value for all points to avoid plotting edges when np.nan - if ( - "edgecolors" in plot_kw - and matplotlib.colors.is_color_like(plot_kw["edgecolors"]) - and len(plot_kw["edgecolors"]) != len(plot_data.values) - ): - plot_kw["edgecolors"] = np.repeat(plot_kw["edgecolors"], len(plot_data.values)) - # plot_kw["edgecolors"] = [plot_kw["edgecolors"] if value else "none" for value in mask] + # # set 'edgecolors' to the same value for all points to avoid plotting edges when np.nan + # if ( + # "edgecolors" in plot_kw + # and matplotlib.colors.is_color_like(plot_kw["edgecolors"]) + # and len(plot_kw["edgecolors"]) != len(plot_data.values) + # ): + # plot_kw["edgecolors"] = np.repeat(plot_kw["edgecolors"], len(plot_data.values)) + # # plot_kw["edgecolors"] = [plot_kw["edgecolors"] if value else "none" for value in mask] # point sizes if sizes: @@ -1699,7 +1699,8 @@ def scattermap( if ax: plot_kw_pop.setdefault("ax", ax) v = plot_data[mask].to_dataset() - im = v.plot.scatter(**plot_kw_pop) + if np.any(mask): + im = v.plot.scatter(**plot_kw_pop) # add features if ax: @@ -2097,7 +2098,7 @@ def hatchmap( cartopy.feature: ['coastline', 'borders', 'lakes', 'land', 'ocean', 'rivers', 'states']. geometries_kw : dict, optional Arguments passed to cartopy ax.add_geometry() which adds given geometries (GeoDataFrame geometry) to axis. - legend_kw : dict or boolean optional + legend_kw : dict or boolean, optional Arguments to pass to `ax.legend()`. No legend is added if legend_kw == False. show_time : bool, tuple, string or int. If True, show time (as date) at the bottom right of the figure. From cb91ead11f9c7909f752cf1696844c313d38adbb Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Wed, 17 Apr 2024 18:26:44 -0400 Subject: [PATCH 03/10] nan_edgecolor_scattermap merged here; before preparation for PR --- docs/notebooks/figanos_multiplots.ipynb | 2 +- figanos/matplotlib/plot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/notebooks/figanos_multiplots.ipynb b/docs/notebooks/figanos_multiplots.ipynb index 97cc7d4c..d99923f5 100644 --- a/docs/notebooks/figanos_multiplots.ipynb +++ b/docs/notebooks/figanos_multiplots.ipynb @@ -186,7 +186,7 @@ " \"y\": \"lat\"\n", " },\n", " 'inf_300k': {\n", - " 'hatches': ['**'],\n", + " 'hatches': 'x',\n", " 'col': 'time',\n", " \"x\": \"lon\",\n", " \"y\": \"lat\"\n", diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index 92eafdeb..587c18d5 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1711,7 +1711,7 @@ def scattermap( plot_kw_pop["edgecolors"] = np.array(plot_kw["edgecolors"]) plot_kw_pop["edgecolors"] = plot_kw_pop["edgecolors"][mask] else: - plot_kw_pop.setdefault("edgecolor", "none") + plot_kw_pop.setdefault("edgecolors", "none") for key in ["vmin", "vmax"]: plot_kw_pop.pop(key) From 336c1c936f43bd3f9330aa60e4ab3d3398dbeef6 Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Thu, 18 Apr 2024 14:11:08 -0400 Subject: [PATCH 04/10] support edgecolors AND edgecolor used as aliases in matplotlib.pyplot.scatter --- figanos/matplotlib/plot.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index 587c18d5..ef858ad2 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1487,7 +1487,7 @@ def scattermap( If int or float, becomes center of cmap. Default center is 0. legend_kw : dict, optional Arguments to pass to plt.legend(). Some defaults {"loc": "lower left", "facecolor": "w", "framealpha": 1, - "edgecolors": "w", "bbox_to_anchor": (-0.05, 0)} + "edgecolor": "w", "bbox_to_anchor": (-0.05, 0)} show_time : bool, tuple, string or int. If True, show time (as date) at the bottom right of the figure. Can be a tuple of axis coordinates (0 to 1, as a fraction of the axis length) representing the location @@ -1629,15 +1629,6 @@ def scattermap( f"{len(mask) - np.sum(mask)} nan values were dropped when plotting the color values" ) - # # set 'edgecolors' to the same value for all points to avoid plotting edges when np.nan - # if ( - # "edgecolors" in plot_kw - # and matplotlib.colors.is_color_like(plot_kw["edgecolors"]) - # and len(plot_kw["edgecolors"]) != len(plot_data.values) - # ): - # plot_kw["edgecolors"] = np.repeat(plot_kw["edgecolors"], len(plot_data.values)) - # # plot_kw["edgecolors"] = [plot_kw["edgecolors"] if value else "none" for value in mask] - # point sizes if sizes: if sizes is True: @@ -1683,6 +1674,11 @@ def scattermap( divergent=divergent, ) + # matplotlib treats "edgecolor" and "edgecolors" as aliases, we choose to use "edgecolors" only + if "edgecolor" in plot_kw_pop and "edgecolors" not in plot_kw_pop: + plot_kw_pop["edgecolors"] = plot_kw_pop["edgecolor"] + plot_kw_pop.pop("edgecolor") + # set defaults and create copy without vmin, vmax (conflicts with norm) plot_kw_pop = { "cmap": cmap, From 284441ba4060dd90c2bf75238e9060717632bcea Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Wed, 24 Apr 2024 19:45:50 -0400 Subject: [PATCH 05/10] scattermap: changed variable name plot_kw_pop back to plot_kw and removed deepcopy operation which is already happening in calling utils.empty_dict() --- figanos/matplotlib/plot.py | 66 ++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index ef858ad2..60431a5b 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1526,17 +1526,15 @@ def scattermap( if "row" not in plot_kw and "col" not in plot_kw: use_attrs.setdefault("title", "description") - plot_kw_pop = copy.deepcopy(plot_kw) # copy plot_kw to modify and pop info in it - # extract plot_kw from dict if needed if isinstance(data, dict) and plot_kw and list(data.keys())[0] in plot_kw.keys(): - plot_kw_pop = plot_kw_pop[list(data.keys())[0]] + plot_kw = plot_kw[list(data.keys())[0]] # figanos does not use xr.plot.scatter default markersize if "markersize" in plot_kw.keys(): if not sizes: sizes = plot_kw["markersize"] - plot_kw_pop.pop("markersize") + plot_kw.pop("markersize") # if data is dict, extract if isinstance(data, dict): @@ -1576,13 +1574,13 @@ def scattermap( elif ax is not None and ("col" in plot_kw or "row" in plot_kw): raise ValueError("Cannot use 'ax' and 'col'/'row' at the same time.") elif ax is None: - plot_kw_pop = {"subplot_kws": {"projection": projection}} | plot_kw_pop + plot_kw = {"subplot_kws": {"projection": projection}} | plot_kw cfig_kw = fig_kw.copy() if "figsize" in fig_kw: # add figsize to plot_kw for facetgrid - plot_kw_pop.setdefault("figsize", fig_kw["figsize"]) + plot_kw.setdefault("figsize", fig_kw["figsize"]) cfig_kw.pop("figsize") if len(cfig_kw) >= 1: - plot_kw_pop = {"subplot_kws": {"projection": projection}} | plot_kw_pop + plot_kw = {"subplot_kws": {"projection": projection}} | plot_kw warnings.warn( "Only figsize and figure.add_subplot() arguments can be passed to fig_kw when using facetgrid." ) @@ -1602,9 +1600,9 @@ def scattermap( cbar_label = get_attributes(use_attrs["cbar_label"], data) if "add_colorbar" not in plot_kw or plot_kw["add_colorbar"] is not False: - plot_kw_pop.setdefault("cbar_kwargs", {}) - plot_kw_pop["cbar_kwargs"].setdefault("label", wrap_text(cbar_label)) - plot_kw_pop["cbar_kwargs"].setdefault("pad", 0.015) + plot_kw.setdefault("cbar_kwargs", {}) + plot_kw["cbar_kwargs"].setdefault("label", wrap_text(cbar_label)) + plot_kw["cbar_kwargs"].setdefault("pad", 0.015) # colormap if isinstance(cmap, str): @@ -1656,47 +1654,47 @@ def scattermap( target_range=size_range, data_range=None, ) - plot_kw_pop.setdefault("add_legend", False) + plot_kw.setdefault("add_legend", False) if ax: - plot_kw_pop.setdefault("s", pt_sizes) + plot_kw.setdefault("s", pt_sizes) else: - plot_kw_pop.setdefault("s", pt_sizes[0]) + plot_kw.setdefault("s", pt_sizes[0]) # norm - plot_kw_pop.setdefault("vmin", np.nanmin(plot_data.values[mask])) - plot_kw_pop.setdefault("vmax", np.nanmax(plot_data.values[mask])) + plot_kw.setdefault("vmin", np.nanmin(plot_data.values[mask])) + plot_kw.setdefault("vmax", np.nanmax(plot_data.values[mask])) norm = custom_cmap_norm( cmap, - vmin=plot_kw_pop["vmin"], - vmax=plot_kw_pop["vmax"], + vmin=plot_kw["vmin"], + vmax=plot_kw["vmax"], levels=levels, divergent=divergent, ) - # matplotlib treats "edgecolor" and "edgecolors" as aliases, we choose to use "edgecolors" only - if "edgecolor" in plot_kw_pop and "edgecolors" not in plot_kw_pop: - plot_kw_pop["edgecolors"] = plot_kw_pop["edgecolor"] - plot_kw_pop.pop("edgecolor") + # matplotlib.pyplot.scatter treats "edgecolor" and "edgecolors" as aliases so we accept "edgecolor" and convert it + if "edgecolor" in plot_kw and "edgecolors" not in plot_kw: + plot_kw["edgecolors"] = plot_kw["edgecolor"] + plot_kw.pop("edgecolor") # set defaults and create copy without vmin, vmax (conflicts with norm) - plot_kw_pop = { + plot_kw = { "cmap": cmap, "norm": norm, "transform": transform, "zorder": 8, "marker": "o", "edgecolors": "none", - } | plot_kw_pop + } | plot_kw # chek if edgecolors in plot_kw and match len of plot_data if "edgecolors" in plot_kw: if matplotlib.colors.is_color_like(plot_kw["edgecolors"]): - plot_kw_pop["edgecolors"] = np.repeat( + plot_kw["edgecolors"] = np.repeat( plot_kw["edgecolors"], len(plot_data.where(mask).values) ) elif len(plot_kw["edgecolors"]) != len(plot_data.values): - plot_kw_pop["edgecolors"] = np.repeat( + plot_kw["edgecolors"] = np.repeat( plot_kw["edgecolors"][0], len(plot_data.where(mask).values) ) warnings.warn( @@ -1704,21 +1702,21 @@ def scattermap( ) else: if isinstance(plot_kw["edgecolors"], list): - plot_kw_pop["edgecolors"] = np.array(plot_kw["edgecolors"]) - plot_kw_pop["edgecolors"] = plot_kw_pop["edgecolors"][mask] + plot_kw["edgecolors"] = np.array(plot_kw["edgecolors"]) + plot_kw["edgecolors"] = plot_kw["edgecolors"][mask] else: - plot_kw_pop.setdefault("edgecolors", "none") + plot_kw.setdefault("edgecolors", "none") for key in ["vmin", "vmax"]: - plot_kw_pop.pop(key) + plot_kw.pop(key) # plot - plot_kw_pop = {"x": "lon", "y": "lat", "hue": plot_data.name} | plot_kw_pop + plot_kw = {"x": "lon", "y": "lat", "hue": plot_data.name} | plot_kw if ax: - plot_kw_pop.setdefault("ax", ax) + plot_kw.setdefault("ax", ax) + # plot_data_masked = plot_data[mask].to_dataset() plot_data_masked = plot_data.where(mask).to_dataset() - if np.any(mask): - im = plot_data_masked.plot.scatter(**plot_kw_pop) + im = plot_data_masked.plot.scatter(**plot_kw) # add features if ax: @@ -1781,7 +1779,7 @@ def scattermap( np.resize(sdata.values[mask], (sdata.values[mask].size, 1)), np.resize(pt_sizes[mask], (pt_sizes[mask].size, 1)), max_entries=6, - marker=plot_kw_pop["marker"], + marker=plot_kw["marker"], ) # legend spacing if size_range[1] > 200: From 2bc3a2300892b6405924eeb162d8aa3ae8fb58f0 Mon Sep 17 00:00:00 2001 From: Marco Braun Date: Thu, 25 Apr 2024 11:14:24 -0400 Subject: [PATCH 06/10] hatchmap: removed deepcopy operation which is already happening in calling utils.empty_dict() --- figanos/matplotlib/plot.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/figanos/matplotlib/plot.py b/figanos/matplotlib/plot.py index 60431a5b..8f97c4b9 100644 --- a/figanos/matplotlib/plot.py +++ b/figanos/matplotlib/plot.py @@ -1714,7 +1714,6 @@ def scattermap( if ax: plot_kw.setdefault("ax", ax) - # plot_data_masked = plot_data[mask].to_dataset() plot_data_masked = plot_data.where(mask).to_dataset() im = plot_data_masked.plot.scatter(**plot_kw) @@ -2175,26 +2174,23 @@ def hatchmap( dattrs = None plot_data = {} - dc = copy.deepcopy( - plot_kw - ) # make sure nested dict is not changed outside this function # convert data to dict (if not one) if not isinstance(data, dict): if isinstance(data, xr.DataArray): plot_data = {data.name: data} if data.name not in plot_kw.keys(): - plot_kw = {data.name: dc} + plot_kw = {data.name: plot_kw} elif isinstance(data, xr.Dataset): dattrs = data plot_data = {var: data[var] for var in data.data_vars} for v in plot_data.keys(): if v not in plot_kw.keys(): - plot_kw[v] = dc + plot_kw[v] = plot_kw else: for k, v in data.items(): if k not in plot_kw.keys(): - plot_kw[k] = dc + plot_kw[k] = plot_kw if isinstance(v, xr.Dataset): dattrs = k plot_data[k] = v[list(v.data_vars)[0]] From 5d28a5484230b908e9f1060a5311751fe384e3a4 Mon Sep 17 00:00:00 2001 From: Marco Braun <43412203+vindelico@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:25:38 -0400 Subject: [PATCH 07/10] Update CHANGES.rst --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index cc2d9a83..af7d5be6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,6 +8,7 @@ Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Marco Bra New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +* No-legend option in `hatchmap`; use `edgecolor` and `edgecolors` as aliases (:pull:`177`) * Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). * Added style sheet ``transparent.mplstyle`` (:issue:`183`, :pull:`185`) * Fix NaN issues, extreme values in sizes legend and added edgecolors in ``fg.matplotlib.scattermap`` (:pull:`184`). From 12cb82eb23250ced04d91aaac9f4607a03520295 Mon Sep 17 00:00:00 2001 From: Marco Braun <43412203+vindelico@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:26:36 -0400 Subject: [PATCH 08/10] Update CHANGES.rst --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index af7d5be6..7ccd0556 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,7 @@ Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Marco Bra New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* No-legend option in `hatchmap`; use `edgecolor` and `edgecolors` as aliases (:pull:`177`) +* No-legend option in ``hatchmap``; use ``edgecolor`` and ``edgecolors`` as aliases (:pull:`177`) * Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). * Added style sheet ``transparent.mplstyle`` (:issue:`183`, :pull:`185`) * Fix NaN issues, extreme values in sizes legend and added edgecolors in ``fg.matplotlib.scattermap`` (:pull:`184`). From 77acc527457d8ff75bd064c9dd741fa3fb4a60b1 Mon Sep 17 00:00:00 2001 From: Marco Braun <43412203+vindelico@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:27:25 -0400 Subject: [PATCH 09/10] Update CHANGES.rst --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7ccd0556..6a078974 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,7 @@ Contributors to this version: Trevor James Smith (:user:`Zeitsperre`), Marco Bra New features and enhancements ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* No-legend option in ``hatchmap``; use ``edgecolor`` and ``edgecolors`` as aliases (:pull:`177`) +* No-legend option in ``hatchmap``; use ``edgecolor`` and ``edgecolors`` as aliases (:pull:`195`) * Use list or ndarray as levels for colorbar in gridmap and small bug fixes (:pull:`176`). * Added style sheet ``transparent.mplstyle`` (:issue:`183`, :pull:`185`) * Fix NaN issues, extreme values in sizes legend and added edgecolors in ``fg.matplotlib.scattermap`` (:pull:`184`). From 0a9956288da55702331c95dca4c56fbe0c44ceb4 Mon Sep 17 00:00:00 2001 From: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:03:22 -0400 Subject: [PATCH 10/10] fix merge --- src/figanos/matplotlib/plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/figanos/matplotlib/plot.py b/src/figanos/matplotlib/plot.py index 399fe775..d4fae3c0 100644 --- a/src/figanos/matplotlib/plot.py +++ b/src/figanos/matplotlib/plot.py @@ -1767,7 +1767,7 @@ def scattermap( divergent=divergent, linspace_out=True, ) - plot_kw_pop.setdefault("levels", lin) + plot_kw.setdefault("levels", lin) elif (divergent is not False) and ("levels" not in plot_kw): norm = custom_cmap_norm( @@ -1777,7 +1777,7 @@ def scattermap( levels=levels, divergent=divergent, ) - plot_kw_pop.setdefault("norm", norm) + plot_kw.setdefault("norm", norm) # matplotlib.pyplot.scatter treats "edgecolor" and "edgecolors" as aliases so we accept "edgecolor" and convert it if "edgecolor" in plot_kw and "edgecolors" not in plot_kw: