diff --git a/src/sisl/viz/figure/figure.py b/src/sisl/viz/figure/figure.py index 239fb32917..49ecdd2a63 100644 --- a/src/sisl/viz/figure/figure.py +++ b/src/sisl/viz/figure/figure.py @@ -42,6 +42,8 @@ class Figure: _SUBPLOTS = 3 _ANIMATION = 4 + plot_actions: list = [] + def __init__(self, plot_actions, *args, **kwargs): self.plot_actions = plot_actions self._build(plot_actions, *args, **kwargs) diff --git a/src/sisl/viz/figure/matplotlib.py b/src/sisl/viz/figure/matplotlib.py index 6ea99ded6c..3b30524a43 100644 --- a/src/sisl/viz/figure/matplotlib.py +++ b/src/sisl/viz/figure/matplotlib.py @@ -5,6 +5,7 @@ import itertools import math +from typing import Optional import matplotlib import matplotlib.pyplot as plt @@ -33,6 +34,9 @@ class MatplotlibFigure(Figure): _axes_defaults = {} + figure: Optional[plt.Figure] = None + axes: Optional[plt.Axes] = None + def _init_figure(self, *args, **kwargs): self.figure, self.axes = self._init_plt_figure() self._init_axes() diff --git a/src/sisl/viz/figure/plotly.py b/src/sisl/viz/figure/plotly.py index 24a4bf8a6f..f6acae46c8 100644 --- a/src/sisl/viz/figure/plotly.py +++ b/src/sisl/viz/figure/plotly.py @@ -149,6 +149,8 @@ class PlotlyFigure(Figure): _layout_defaults = {} + figure: Optional[go.Figure] = None + def _init_figure(self, *args, **kwargs): self.figure = go.Figure() self.update_layout(**self._layout_defaults) diff --git a/src/sisl/viz/plots/merged.py b/src/sisl/viz/plots/merged.py index b6a9ff8cb7..5086f0dc95 100644 --- a/src/sisl/viz/plots/merged.py +++ b/src/sisl/viz/plots/merged.py @@ -35,13 +35,8 @@ def merge_plots( which controls the arrangement ("rows", "cols" or "square"). """ - def _san_plot(plot): - if isinstance(plot, Plot) and plot._nupdates == 0: - plot.get() - return plot - plot_actions = combined( - *[_san_plot(fig).plot_actions for fig in figures], + *[fig.plot_actions for fig in figures], composite_method=composite_method, **kwargs, )