Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions oemoflex/tools/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@ def prepare_dispatch_data(df, bus_name, demand_name, labels_dict=None):
replaced by more simple names. Columns the same name are grouped together. Really small
numerical values which are practically zero are replaced with 0.0.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
df : pandas.DataFrame
Expand Down Expand Up @@ -271,6 +277,12 @@ def filter_timeseries(df, start_date=None, end_date=None):
If start_date or end_date are not given, filtering is done from the first
available date or to the last available date.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
df : pandas.DataFrame
Expand Down Expand Up @@ -330,6 +342,12 @@ def stackplot(ax, df, colors_odict):
of labels in the colors_odict. It is stacked beginning with the x-axis as
the bottom.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
ax : matplotlib.AxesSubplot
Expand Down Expand Up @@ -365,6 +383,12 @@ def lineplot(ax, df, colors_odict, linewidth=1):
r"""
Plots data as a lineplot.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
ax : matplotlib.AxesSubplot
Expand All @@ -388,6 +412,12 @@ def plot_dispatch(ax, df, df_demand, unit, colors_odict=None, linewidth=1):
suppliers and other consumers are plotted with a stackplot. Columns with negative vlaues
are stacked below the x axis and columns with positive values above.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
ax : matplotlib.AxesSubplot
Expand Down Expand Up @@ -454,6 +484,12 @@ def plot_dispatch_plotly(
Plots data as a dispatch plot in an interactive plotly plot. The demand is plotted as a
line plot and suppliers and other consumers are plotted with a stackplot.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
---------------
df : pandas.DataFrame
Expand Down Expand Up @@ -568,6 +604,12 @@ def plot_grouped_bar(ax, df, color_dict, unit, stacked=False):
will be interpreted as groups (e.g. regions), the columns as different categories (e.g. energy
carriers) within the groups which will be plotted in different colors.

The DataFrame `df` is expected to have this form:

.. csv-table::
:file: ../../tests/_files/plot_data/input_prepare_dispatch_data.csv
:header-rows: 1

Parameters
----------
ax: matplotlib Axes object
Expand Down
2 changes: 2 additions & 0 deletions tests/_files/plot_data/input_prepare_dispatch_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a,b,c
1,2,3