diff --git a/spb/backends/bokeh/bokeh.py b/spb/backends/bokeh/bokeh.py index e62bbd1..b8520be 100644 --- a/spb/backends/bokeh/bokeh.py +++ b/spb/backends/bokeh/bokeh.py @@ -273,7 +273,13 @@ def _init_cyclers(self): @property def fig(self): """Returns the figure.""" - if len(self.renderers) > 0 and len(self.renderers[0].handles) == 0: + if ( + (len(self.renderers) > 0) and + ( + (self.renderers[0] and len(self.renderers[0].handles) == 0) + or (self.renderers[0] is None) + ) + ): # if the backend was created without showing it self.draw() return self._fig diff --git a/spb/backends/k3d/k3d.py b/spb/backends/k3d/k3d.py index 5b9ef69..55c13d9 100644 --- a/spb/backends/k3d/k3d.py +++ b/spb/backends/k3d/k3d.py @@ -205,7 +205,13 @@ def __init__(self, *args, **kwargs): @property def fig(self): """Returns the figure.""" - if len(self.renderers) > 0 and len(self.renderers[0].handles) == 0: + if ( + (len(self.renderers) > 0) and + ( + (self.renderers[0] and len(self.renderers[0].handles) == 0) + or (self.renderers[0] is None) + ) + ): # if the backend was created without showing it self._process_renderers() return self._fig