From 801bcf2942df04d7bed94b2e7fb148dd7b569ec6 Mon Sep 17 00:00:00 2001 From: Bryan Rumsey Date: Mon, 11 Jul 2022 11:23:39 -0400 Subject: [PATCH] Add check to properly raise error when attempting to plot and empty domain. --- spatialpy/core/domain.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spatialpy/core/domain.py b/spatialpy/core/domain.py index cdb033bf..f7529929 100644 --- a/spatialpy/core/domain.py +++ b/spatialpy/core/domain.py @@ -571,6 +571,9 @@ def plot_types(self, width=None, height=None, colormap=None, size=None, title=No :returns: Plotly figure of domain types if, use_matplotlib=False and return_plotly_figure=True :rtype: None or dict ''' + if len(self.vertices) == 0: + raise DomainError("The domain does not contain particles.") + from spatialpy.core.result import _plotly_iterate # pylint: disable=import-outside-toplevel if not use_matplotlib: