Skip to content

Commit

Permalink
Plot xs_rotation, rotates x tick labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Jun 23, 2018
1 parent 2563c9c commit e700ea2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion conx/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2290,7 +2290,7 @@ def get_metric(self, metric):

def plot(self, metrics=None, ymin=None, ymax=None, start=0, end=None, legend='best',
label=None, symbols=None, default_symbol="-", title=None, return_fig_ax=False, fig_ax=None,
format=None):
format=None, xs_rotation=None):
"""Plots the current network history for the specific epoch range and
metrics. metrics is '?', 'all', a metric keyword, or a list of metric keywords.
if metrics is None, loss and accuracy are plotted on separate graphs.
Expand Down Expand Up @@ -2367,6 +2367,10 @@ def plot(self, metrics=None, ymin=None, ymax=None, start=0, end=None, legend='be
plt.legend(loc=legend)
if title is None:
title = self.name
if xs_rotation is not None:
plt.setp(ax.get_xticklabels(),
rotation=xs_rotation,
horizontalalignment='right')
plt.title(title)
if return_fig_ax:
return (fig, ax)
Expand Down
6 changes: 5 additions & 1 deletion conx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ def plot3D(function, x_range=None, y_range=None, width=4.0, height=4.0, xlabel="

def plot(data=[], width=8.0, height=4.0, xlabel="", ylabel="", title="",
label="", symbols=None, default_symbol=None, ymin=None, xmin=None, ymax=None, xmax=None,
format='svg', xs=None):
format='svg', xs=None, xs_rotation=None):
"""
Create a line or scatter plot given the y-coordinates of a set of
lines.
Expand Down Expand Up @@ -1326,6 +1326,10 @@ def plot(data=[], width=8.0, height=4.0, xlabel="", ylabel="", title="",
plt.xlim(xmin=xmin)
if xmax is not None:
plt.xlim(xmax=xmax)
if xs_rotation is not None:
plt.setp(ax.get_xticklabels(),
rotation=xs_rotation,
horizontalalignment='right')
if format is None:
plt.show(block=False)
result = None
Expand Down

0 comments on commit e700ea2

Please sign in to comment.