Skip to content

Auto sizing for result plotting #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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