diff --git a/src/sisl/viz/figure/matplotlib.py b/src/sisl/viz/figure/matplotlib.py index dccc43e433..064ecb7308 100644 --- a/src/sisl/viz/figure/matplotlib.py +++ b/src/sisl/viz/figure/matplotlib.py @@ -238,6 +238,7 @@ def _plotly_dash_to_matplotlib(self, dash: str) -> str: return { "dash": "dashed", "dot": "dotted", + None: "solid", }.get(dash, dash) def _sanitize_colorscale(self, colorscale): @@ -380,6 +381,8 @@ def draw_multisize_line( # Set the values used for colormapping lc.set_linewidth(line.get("width", 1)) lc.set_linestyle(self._plotly_dash_to_matplotlib(line.get("dash", "solid"))) + lc.set_color(line.get("color")) + lc.set_alpha(line.get("opacity")) axes = _axes or self._get_subplot_axes(row=row, col=col) @@ -411,11 +414,21 @@ def draw_area_line( if dependent_axis in ("y", None): axes.fill_between( - x, y + spacing, y - spacing, color=line.get("color"), label=name + x, + y + spacing, + y - spacing, + color=line.get("color"), + label=name, + alpha=line.get("opacity"), ) elif dependent_axis == "x": axes.fill_betweenx( - y, x + spacing, x - spacing, color=line.get("color"), label=name + y, + x + spacing, + x - spacing, + color=line.get("color"), + label=name, + alpha=line.get("opacity"), ) else: raise ValueError( @@ -435,6 +448,7 @@ def draw_scatter( col=None, _axes=None, meta={}, + legendgroup=None, **kwargs, ): axes = _axes or self._get_subplot_axes(row=row, col=col) diff --git a/src/sisl/viz/figure/plotly.py b/src/sisl/viz/figure/plotly.py index 9b3088b864..ca465999b0 100644 --- a/src/sisl/viz/figure/plotly.py +++ b/src/sisl/viz/figure/plotly.py @@ -584,6 +584,7 @@ def draw_area_line( "legendgroup": name, "showlegend": kwargs.pop("showlegend", None), "fill": "toself", + "opacity": line.get("opacity"), "meta": kwargs.pop("meta", {}), }, row=row, diff --git a/src/sisl/viz/plots/bands.py b/src/sisl/viz/plots/bands.py index 590d737030..d06e1cc9e2 100644 --- a/src/sisl/viz/plots/bands.py +++ b/src/sisl/viz/plots/bands.py @@ -291,7 +291,7 @@ def fatbands_plot( orb_dim="orb", spin_dim="spin", sanitize_group=orbital_manager, - group_vars=("color", "dash"), + group_vars=("color", "dash", "opacity"), groups_dim="group", drop_empty=True, spin_reduce=False,