Skip to content

Commit

Permalink
Merge pull request #446 from StochSS/generalize-plot-axes-labels
Browse files Browse the repository at this point in the history
hotfix [main] - generalize plot y axis labels to "Value" and remove empty space from …
  • Loading branch information
Matthew Geiger authored Oct 13, 2020
2 parents 0d5bb0e + ca9eb01 commit d43801d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions gillespy2/core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def to_csv(self, path=None, nametag=None, stamp=None):
this_line.append(trajectory[species][n])
csv_writer.writerow(this_line) # write one line of the CSV file

def plot(self, index=None, xaxis_label="Time ", xscale='linear', yscale='linear', yaxis_label="Species Population",
def plot(self, index=None, xaxis_label="Time", xscale='linear', yscale='linear', yaxis_label="Value",
style="default", title=None, show_title=False, show_legend=True, multiple_graphs=False,
included_species_list=[], save_png=False, figsize=(18, 10)):
"""
Expand Down Expand Up @@ -339,7 +339,7 @@ def plot(self, index=None, xaxis_label="Time ", xscale='linear', yscale='linear'
elif save_png:
plt.savefig(title)

def plotplotly(self, index=None, xaxis_label="Time ", yaxis_label="Species Population", title=None,
def plotplotly(self, index=None, xaxis_label="Time", yaxis_label="Value", title=None,
show_title=False, show_legend=True, multiple_graphs=False, included_species_list=[],
return_plotly_figure=False, **layout_args):
""" Plots the Results using plotly. Can only be viewed in a Jupyter Notebook.
Expand Down Expand Up @@ -535,7 +535,7 @@ def stddev_ensemble(self, ddof=0):
output_results = Results(data=[output_trajectory]) # package output_trajectory in a Results object
return output_results

def plotplotly_std_dev_range(self, xaxis_label="Time ", yaxis_label="Species Population", title=None,
def plotplotly_std_dev_range(self, xaxis_label="Time", yaxis_label="Value", title=None,
show_title=False, show_legend=True, included_species_list=[],
return_plotly_figure=False, ddof=0, **layout_args):
"""
Expand Down Expand Up @@ -653,7 +653,7 @@ def plotplotly_std_dev_range(self, xaxis_label="Time ", yaxis_label="Species Pop
else:
iplot(fig)

def plot_std_dev_range(self, xscale='linear', yscale='linear', xaxis_label="Time ", yaxis_label="Species Population"
def plot_std_dev_range(self, xscale='linear', yscale='linear', xaxis_label="Time", yaxis_label="Value"
, title=None, show_title=False, style="default", show_legend=True, included_species_list=[],
ddof=0, save_png=False, figsize=(18, 10)):
"""
Expand Down
4 changes: 2 additions & 2 deletions test/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_plotly_layout_args(self):
with mock.patch('plotly.graph_objs.Scatter') as mock_scatter:
with mock.patch('plotly.graph_objs.Layout') as mock_layout:
results.plotplotly(return_plotly_figure=True,xscale='log')
mock_layout.assert_called_with(showlegend=True, title='', xaxis_title='Time ', xscale='log', yaxis_title='Species Population')
mock_layout.assert_called_with(showlegend=True, title='', xaxis_title='Time', xscale='log', yaxis_title='Value')

def test_plotly_std_dev_range_layout_args(self):
from unittest import mock
Expand All @@ -59,7 +59,7 @@ def test_plotly_std_dev_range_layout_args(self):
with mock.patch('plotly.graph_objs.Layout') as mock_layout:
results.plotplotly_std_dev_range(return_plotly_figure=True, xscale='log')
mock_layout.assert_called_with(legend={'traceorder':'normal'},showlegend=True, title='Standard Deviation Range',
xaxis_title='Time ', xscale='log', yaxis_title='Species Population')
xaxis_title='Time', xscale='log', yaxis_title='Value')

def test_pickle_stable_plot_iterate(self):
from unittest import mock
Expand Down

0 comments on commit d43801d

Please sign in to comment.