Skip to content

Commit

Permalink
Merge pull request #200 from StochSS/plotting-auto-width-height
Browse files Browse the repository at this point in the history
Auto sizing for result plotting
  • Loading branch information
seanebum authored Nov 29, 2021
2 parents 7cd32f7 + 324633e commit ffda632
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions spatialpy/Result.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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']):
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit ffda632

Please sign in to comment.