Commit b5c1ae4c authored by Markus Mirz's avatar Markus Mirz

added legend location as parameter

parent 70b1a1fa
...@@ -3,7 +3,7 @@ import numpy as np ...@@ -3,7 +3,7 @@ import numpy as np
from .timeseries import * from .timeseries import *
def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, plt_color=None): def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, plt_color=None, plt_legend_loc='lower right'):
""" """
This function plots either a single timeseries or several timeseries in the figure defined by figure_id. This function plots either a single timeseries or several timeseries in the figure defined by figure_id.
Several timeseries (handed over in a list) are plotted in several subplots. Several timeseries (handed over in a list) are plotted in several subplots.
...@@ -16,7 +16,7 @@ def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, p ...@@ -16,7 +16,7 @@ def plot_timeseries(figure_id, timeseries, plt_linestyle='-', plt_linewidth=2, p
else: else:
plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth) plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label, linewidth=plt_linewidth)
plt.gca().autoscale(axis='x', tight=True) plt.gca().autoscale(axis='x', tight=True)
plt.legend(loc='lower right') plt.legend(loc=plt_legend_loc)
else: else:
for ts in timeseries: for ts in timeseries:
plt.subplot(len(timeseries), 1, timeseries.index(ts) + 1) plt.subplot(len(timeseries), 1, timeseries.index(ts) + 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment