Skip to content

Commit

Permalink
Merge pull request #31 from bjodah/tweaks
Browse files Browse the repository at this point in the history
LaTeX labels: getattr(names, latex_attr)
  • Loading branch information
bjodah committed May 26, 2016
2 parents 7b5beff + 3bbe883 commit f36f089
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pyodesys/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def plot_result(x, y, params=(), indices=None, plot=None, plot_kwargs_cb=None,
m=('o', 'v', '8', 's', 'p', 'x', '+', 'd', 's'),
m_lim=-1, lines=None, interpolate=None, interp_from_deriv=None,
names=None, post_processors=(), xlabel=None, ylabel=None,
xscale=None, yscale=None):
xscale=None, yscale=None, latex_attr='latex_name'):
"""
Plot the depepndent variables vs. the independent variable
Expand Down Expand Up @@ -73,6 +73,12 @@ def plot_kwargs_cb(idx, lines=False, markers=False, labels=None):

if labels:
kwargs['label'] = labels[idx]
if latex_attr:
try:
kwargs['label'] = '$' + getattr(labels[idx],
latex_attr) + '$'
except (AttributeError, TypeError):
pass
return kwargs
else:
plot_kwargs_cb = plot_kwargs_cb or (lambda idx: {})
Expand Down

0 comments on commit f36f089

Please sign in to comment.