Function to plot the load, pv, or grid data versus the forecast or original data :param var: str, default 'load' one of 'load', 'pv', 'grid', which variable to plot :param days_to_plot: tuple, len 2. default (0,10) defines the days to plot. Plots all
(self, var='load', days_to_plot=(0, 10), original=True, forecast=True, samples=True)
| 955 | return samples |
| 956 | |
| 957 | def plot(self, var='load', days_to_plot=(0, 10), original=True, forecast=True, samples=True): |
| 958 | """ |
| 959 | Function to plot the load, pv, or grid data versus the forecast or original data |
| 960 | :param var: str, default 'load' |
| 961 | one of 'load', 'pv', 'grid', which variable to plot |
| 962 | :param days_to_plot: tuple, len 2. default (0,10) |
| 963 | defines the days to plot. Plots all hours from days_to_plot[0] to days_to_plot[1] |
| 964 | :param original: bool, default True |
| 965 | whether to plot the underlying microgrid data |
| 966 | :param forecast: bool, default True |
| 967 | whether to plot the forecast stored in self.forecast |
| 968 | :param samples: bool, default True |
| 969 | whether to plot the samples stored in self.samples |
| 970 | :return: |
| 971 | None |
| 972 | """ |
| 973 | |
| 974 | if var not in self.forecasts.columns: |
| 975 | raise ValueError('Cound not find var {} in self.forecasts, should be one of {}'.format(var, self.forecasts.columns)) |
| 976 | |
| 977 | indices = slice(24 * days_to_plot[0], 24 * days_to_plot[1]) |
| 978 | |
| 979 | if original: |
| 980 | plt.plot(self.underlying_data.loc[indices, var].index, self.underlying_data.loc[indices, var].values, |
| 981 | label='original', color='b') |
| 982 | if forecast: |
| 983 | plt.plot(self.forecasts.loc[indices, var].index, self.forecasts.loc[indices, var].values, label='forecast', |
| 984 | color='r') |
| 985 | if samples: |
| 986 | for sample in self.samples: |
| 987 | plt.plot(sample.loc[indices, var].index, sample.loc[indices, var].values, color='k') |
| 988 | |
| 989 | plt.legend() |
| 990 | plt.show() |
| 991 | |
| 992 | |
| 993 | class ForecastArgSet(dict): |