Creates plots based on the subset of a multi-indexed pandas dataframe of the
- subset (pandas.DataFrame) – A subset of the results DataFrame.
- ax (matplotlib axis object) – Axis object of the last plot.
pandas.DataFrame – A subset of the results DataFrame.
matplotlib axis object – Axis object of the last plot.
Method to convert a dictionary containing the components and its colors to a color list that can be directly used with the color parameter of the pandas plotting method.
Parameters: colordict (dictionary) – A dictionary that has all possible components as keys and its colors as items. Returns: Containing the colors of all components of the subset attribute Return type: list
io_plot(bus_label, cdict, line_kwa=None, lineorder=None, bar_kwa=None, barorder=None, **kwargs)¶
Plotting a combined bar and line plot to see the fitting of in- and out-coming flows of a bus balance.
- bus_label (string) – Uid of the bus to plot the balance.
- cdict (dictionary) – A dictionary that has all possible components as keys and its colors as items.
- line_kwa (dictionary) – Keyword arguments to be passed to the pandas line plot.
- bar_kwa (dictionary) – Keyword arguments to be passed to the pandas bar plot.
- lineorder (list) – Order of columns to plot the line plot
- barorder (list) – Order of columns to plot the bar plot
Further keyword arguments will be passed to the
Returns: Manipulated labels to correct the unusual construction of the stack line plot. You can use them for further manipulations. Return type: handles, labels
outside_legend(reverse=False, plotshare=0.9, **kwargs)¶
Move the legend outside the plot. Bases on the ideas of Joe Kington. See http://stackoverflow.com/questions/4700614/how-to-put-the-legend-out-of-the-plot for more information.
- reverse (boolean (default: False)) – Print out the legend in reverse order. This is interesting for stack-plots to have the legend in the same order as the stacks.
- plotshare (real (default: 0.9)) – Share of the plot area to create space for the legend (0 to 1).
- loc (string (default: ‘center left’)) – Location of the plot.
- bbox_to_anchor (tuple (default: (1, 0.5))) – Set the anchor for the legend.
- ncol (integer (default: 1)) – Number of columns of the legend.
- handles (list of handles) – A list of handels if they are already modified by another function or method. Normally these handles will be automatically taken from the artist object.
- lables (list of labels) – A list of labels if they are already modified by another function or method. Normally these handles will be automatically taken from the artist object.
All keyword arguments (kwargs) will be directly passed to the matplotlib legend class. See http://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend for more parameters.
Passing the subset attribute to the pandas plotting method. All parameters will be directly passed to pandas.DataFrame.plot(). See http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.plot.html for more information.
Returns: Return type: self
Change the order of the subset DataFrame
Parameters: order (list) – New order of columns Returns: Return type: self
set_datetime_ticks(tick_distance=None, number_autoticks=3, date_format='%d-%m-%Y %H:%M')¶
Set configurable ticks for the time axis. One can choose the number of ticks or the distance between ticks and the format.
- tick_distance (real) – The distance between to ticks in hours. If not set autoticks are set (see number_autoticks).
- number_autoticks (int (default: 3)) – The number of ticks on the time axis, independent of the time range. The higher the number of ticks is, the shorter should be the date_format string.
- date_format (string (default: '%d-%m-%Y %H:%M')) – The string to define the format of the date and time. See https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior for more information.
Method for slicing the ResultsDataFrame. The subset attribute will set to an unstacked subset. The self-attribute is returned to allow chaining. This method is an extension of the
slice_unstackedmethod of the ResultsDataFrame class (parent class).
Parameters: unstacklevel (string (default: 'obj_label')) – Level to unstack the subset of the DataFrame.
Creates a multi-indexed pandas dataframe from a solph result object and holds methods to create subsets of the data.
This is so far only a rough sketch and serves as a base for discussion.
- result_object (dictionary) – solph result objects
- bus_labels (list if strings) – List of strings with buses that should be contained in dataframe. If not set, all buses are contained.
dictionary – solph result objects
list if strings – List of strings with buses that should be contained in dataframe. If not set, all buses are contained.
list if strings – List of strings with bus types that should be contained in dataframe. If not set, all bus types are contained.
pandas dataframe – Multi-indexed pandas dataframe holding the data from the result object. For more information on advanced dataframe indexing see: http://pandas.pydata.org/pandas-docs/stable/advanced.html
Method for saving bus balances of the ResultsDataFrame as single csv files. A balance around each bus with inputs, outputs and other values is saved for a passed list of bus labels. If no labels are passed, all busses are saved. Additionally, an output path for the files can be specified.
- bus_labels (list of strings) –
- output_path (string) –
Method for slicing the ResultsDataFrame. An balance around a bus with inputs, outputs and other values is returned.
Parameters: bus_label (string) –
Method for slicing the ResultsDataFrame. A subset is returned.
- bus_label (string)
- type (string (to_bus/from_bus/other))
- obj_label (string)
- date_from (string) – Start date selection e.g. “2016-01-01 00:00:00”. If not set, the whole time range will be plotted.
- date_to (string) – End date selection e.g. “2016-03-01 00:00:00”. If not set, the whole time range will be plotted.
slice_unstacked(unstacklevel='obj_label', formatted=False, **kwargs)¶
Method for slicing the ResultsDataFrame. An unstacked subset is returned.
- unstacklevel (string (default: 'obj_label')) – Level to unstack the subset of the DataFrame.
- formatted (boolean) –