diff --git a/dataprocessing/plottoolsDPsim.py b/dataprocessing/plotdpsim_deprecated.py similarity index 100% rename from dataprocessing/plottoolsDPsim.py rename to dataprocessing/plotdpsim_deprecated.py diff --git a/dataprocessing/plottools.py b/dataprocessing/plottools.py index 5f2ae4a2ac98a9f5fd1b9c49522aefbff756b322..e3f9da92d97008237b1a4d91d116180653e33982 100644 --- a/dataprocessing/plottools.py +++ b/dataprocessing/plottools.py @@ -3,20 +3,20 @@ import numpy as np from .timeseries import * -def plot_single_ts(figure_id, time_series, plt_linestyle='-'): +def plot_timeseries(figure_id, timeseries, plt_linestyle='-'): plt.figure(figure_id) - plt.plot(time_series.time, time_series.values, linestyle=plt_linestyle, label=time_series.label) - plt.gca().autoscale(axis='x', tight=True) - plt.legend() -def plot_in_subplots(figure_id, time_series, plt_linestyle='-'): - plt.figure(figure_id) - for ts in time_series: - plt.subplot(len(time_series), 1, time_series.index(ts) + 1) - plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label) + if not isinstance(timeseries, list): + plt.plot(timeseries.time, timeseries.values, linestyle=plt_linestyle, label=timeseries.label) plt.gca().autoscale(axis='x', tight=True) plt.legend() + else: + for ts in timeseries: + plt.subplot(len(timeseries), 1, timeseries.index(ts) + 1) + plt.plot(ts.time, ts.values, linestyle=plt_linestyle, label=ts.label) + plt.gca().autoscale(axis='x', tight=True) + plt.legend() -def set_time_series_labels(time_series, time_series_labels): - for ts in time_series: - ts.label = time_series_labels[time_series.index(ts)] \ No newline at end of file +def set_time_series_labels(timeseries_list, time_series_labels): + for ts in timeseries_list: + ts.label = time_series_labels[timeseries_list.index(ts)]