diff --git a/spatialpy/Result.py b/spatialpy/Result.py index 42cc1853..75671619 100644 --- a/spatialpy/Result.py +++ b/spatialpy/Result.py @@ -393,12 +393,16 @@ def plot_species(self, species, t_ndx=None, t_val=None, concentration=False, points, data = self.read_step(t_ndx, debug=debug) if use_matplotlib: - import matplotlib.pyplot as plt - - if width is None: - width = 6.4 + width = 6.4 if width in (None, "auto") else width + height = 4.8 if height in (None, "auto") else height + else: + if width in (None, "auto"): + width = None if width == "auto" else 500 if height is None: - height = 4.8 + height = None if height == "auto" else 500 + + if use_matplotlib: + import matplotlib.pyplot as plt if deterministic or not concentration: d = data[spec_name] @@ -417,11 +421,6 @@ def plot_species(self, species, t_ndx=None, t_val=None, concentration=False, plt.plot() return - if width is None: - width = 500 - if height is None: - height = 500 - # map data to types types = {} for i, val in enumerate(data['type']): @@ -664,12 +663,16 @@ def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=No points, data = self.read_step(t_ndx, debug=debug) if use_matplotlib: - import matplotlib.pyplot as plt - - if width is None: - width = 6.4 + width = 6.4 if width in (None, "auto") else width + height = 4.8 if height in (None, "auto") else height + else: + if width in (None, "auto"): + width = None if width == "auto" else 500 if height is None: - height = 4.8 + height = None if height == "auto" else 500 + + if use_matplotlib: + import matplotlib.pyplot as plt if property_name == "type" and included_types_list is not None: coords = [] @@ -697,11 +700,6 @@ def plot_property(self, property_name, t_ndx=None, t_val=None, p_ndx=0, width=No plt.plot() return - if width is None: - width = 500 - if height is None: - height = 500 - from plotly.offline import init_notebook_mode, iplot types = {}