bulum.plots.altair_plots module

annual_demand_supply_plot(demand: DataFrame, supply: DataFrame, wy_month=7, colours=None, plotWidth=1400, plotHeight=500, show_tooltip=True, label_freq=5, caption=None, legend='Key', xlabel='WY', ylabel='ML/a', sup_opacity=1) Chart

Annual plot of demand and supply from daily timeseries input.

Parameters:
  • demand (pd.DataFrame) – pd.Dataframe of daily demand timeseries to plot.

  • supply (pd.DataFrame) – pd.Dataframe of daily supply timeseries to plot.

  • wy_month (int, optional) – Water year start month. Defaults to 7.

  • colours (list, optional) – Optional list of colours to apply to data. Defaults to selection from “muted rainbow” colour scheme.

  • plotWidth (float, optional) – Optional overall width of figure. Defaults to 1400.

  • plotHeight (float, optional) – Optional overall height of figure. Defaults to 500.

  • show_tooltip (bool, optional) – Optionally show tooltip. Defaults to True.

  • label_freq (int, optional) – Optional frequency to display year label. Defaults to 5 (years).

  • caption (str, optional) – Optional figure caption. Defaults to None.

  • legend (str, optional) – Optional legend label. Defaults to “Key”.

  • xlabel (str, optional) – Optional x axis label. Defaults to “WY”.

  • ylabel (str, optional) – Optional y axis label. Defaults to “ML/a”.

  • sup_opacity (float, optional) – Optional opacity of supply series. Defaults to 1.

Return type:

altair.Chart

annual_plot(df: DataFrame, yLabel='Flow (ML/a)', legendTitle='Data set', wyStartMonth=7, plotWidth=500, plotHeight=300) Chart

Annual plot of timeseries data.

Parameters:
  • df (DataFrame) – Dataframe of daily timeseries data.

  • yLabel (str, optional) – Y axis title. Defaults to ‘Flow (ML/a)’.

  • legendTitle (str, optional) – Legend title. Defaults to ‘Data set’.

  • wyStartMonth (int, optional) – Water year start month. Defaults to 7.

  • plotWidth (int, optional) – Chart width. Defaults to 500.

  • plotHeight (int, optional) – Chart height. Defaults to 300.

Return type:

altair.Chart

daily_plot(df: DataFrame, yLabel='Flow (ML/d)', legendTitle='Data set', plotWidth=500, plotHeight=300) Chart

Daily plot of timeseries data.

Parameters:
  • df (DataFrame) – Dataframe of daily timeseries data.

  • yLabel (str, optional) – Y axis title. Defaults to ‘Flow (ML/d)’.

  • legendTitle (str, optional) – Legend title. Defaults to ‘Data set’.

  • plotWidth (int, optional) – Chart width. Defaults to 500.

  • plotHeight (int, optional) – Chart height. Defaults to 300.

Return type:

altair.Chart

exceedance_plot(df: DataFrame, yLabel='Flow (ML/d)', xLog=False, yLog=False, legendTitle='Data set', plotWidth=500, plotHeight=300, plottingPosition='cunnane') Chart

Exceedance plot of timeseries data.

Parameters:
  • df (pd.DataFrame) – Dataframe of daily timeseries data.

  • yLabel (str, optional) – Y axis title. Defaults to ‘Flow (ML/d)’.

  • xLog (bool, optional) – X axis log flag. Defaults to False.

  • yLog (bool, optional) – Y axis log flag. Defaults to False.

  • legendTitle (str, optional) – Legend title. Defaults to ‘Data set’.

  • plotWidth (int, optional) – Chart width. Defaults to 500.

  • plotHeight (int, optional) – Chart height. Defaults to 300.

  • plottingPosition (str, optional) – Defaults to “cunnane”. Other supported values: “weibull”, “gringorten”. See https://glossary.ametsoc.org/wiki/Plotting_position

Return type:

altair.Chart

exceedence_plot(*args, **kwargs)

Deprecated since version v0.3.0: misspelt historically, see exceedance_plot().

pyblo(dflist: list[Series], sites: list, series: list, wy_month=1, site_order=None, series_order=None, colours=None, start_date=None, end_date=None, series_label='Series', site_label=None, label_freq=10, subtitle=True, width=None, height=35, stroke_width=0.5, stroke_colour='black', font_size=12, grid_colour='lightgrey')

Returns a chart depicting available data by Water Year. Data is arranged by site with colour assigned by series.

Parameters:
  • dflist (list of Series) – List of pd.Series data.

  • sites (list of str) – List of strings by which corresponding data in dflist is grouped by chart row.

  • (list) (series) – List of strings by which corresponding data in dflist is grouped by colour.

  • (int (font_size) – Water year start month. Defaults to 1.

  • optional) – Water year start month. Defaults to 1.

  • (list (colours) – Optional order to arrange Sites by. Defaults to order in sites.

  • optional) – Optional order to arrange Sites by. Defaults to order in sites.

  • (list – Optional order to arrange Series by. Defaults to order in series.

  • optional) – Optional order to arrange Series by. Defaults to order in series.

  • (list – Optional list of colours (arranged by series_order) to apply to Series. Defaults to selection from “muted rainbow” colour scheme.

  • optional) – Optional list of colours (arranged by series_order) to apply to Series. Defaults to selection from “muted rainbow” colour scheme.

  • (DateTime (end_date) – Optional minimum date (%d/%m/%Y) to display. Defaults to None.

  • optional) – Optional minimum date (%d/%m/%Y) to display. Defaults to None.

  • (DateTime – Optional maximum date (%d/%m/%Y) to display. Defaults to None.

  • optional) – Optional maximum date (%d/%m/%Y) to display. Defaults to None.

  • (str (grid_colour) – Optional Series label for legend. Defaults to “Series”.

  • optional) – Optional Series label for legend. Defaults to “Series”.

  • (str – Optional Site y-axis title. Defaults to None.

  • optional) – Optional Site y-axis title. Defaults to None.

  • (int – Optional frequency to display year label. Defaults to 10 (years).

  • optional) – Optional frequency to display year label. Defaults to 10 (years).

  • (bool (subtitle) – Whether to show subtitle. Defaults to True.

  • optional) – Whether to show subtitle. Defaults to True.

  • (int – Optional chart width parameter. Defaults to function of total years.

  • optional) – Optional chart width parameter. Defaults to function of total years.

  • (int – Optional chart height parameter. Represents height per facet/site. Defaults to 35.

  • optional) – Optional chart height parameter. Represents height per facet/site. Defaults to 35.

  • (float (stroke_width) – Optional width of bar outline. Defaults to 0.5.

  • optional) – Optional width of bar outline. Defaults to 0.5.

  • (str – Optional colour of bar outline. Defaults to ‘black’.

  • optional) – Optional colour of bar outline. Defaults to ‘black’.

  • (int – Optional font size to apply to all text. Defaults to 12.

  • optional) – Optional font size to apply to all text. Defaults to 12.

  • (str – Optional colour of gridlines. Defaults to ‘lightgrey’.

  • optional) – Optional colour of gridlines. Defaults to ‘lightgrey’.

Return type:

altair.Chart

residual_mass_curve(df: DataFrame, yLabel='Flow residual mass (ML)', legendTitle='Data set', plotWidth=500, plotHeight=300) Chart

Residual mass curve of timeseries data.

Parameters:
  • df (DataFrame) – Dataframe of daily timeseries data.

  • yLabel (str, optional) – Y axis title. Defaults to ‘Flow residual mass : ML)’.

  • legendTitle (str, optional) – Legend title. Defaults to ‘Data set’.

  • plotWidth (int, optional) – Chart width. Defaults to 500.

  • plotHeight (int, optional) – Chart height. Defaults to 300.

Return type:

altair.Chart

storage_plot(df: DataFrame, triggers=None, data_labels=None, colours=None, ylabel='Volume (ML)', xlabel='Date', legend='Key', caption=None, lineWidth=2, plotWidth=800, plotHeight=300, plot2Height=None, show_tooltip=True) Chart

Daily storage plot of timeseries data.

Parameters:
  • df (pd.DataFrame) – pd.Dataframe of daily timeseries to plot.

  • triggers (dict, optional) – Optional horizontal lines to mark on chart e.g. DSV, FSV. Dictionary where {key: value} = {‘Trigger name’: Y value}. Defaults to None.

  • data_label (str, optional) – Optional string to assign to supplied timeseries. Defaults to df column names.

  • colours (list, optional) – Optional list of colours to apply to data. Defaults to Altair default.

  • ylabel (str, optional) – Optional label for y axis. Defaults to “Volume (ML)”.

  • xlabel (str, optional) – Optional label for x axis. Defaults to “Date”.

  • legend (str, optional) – Optional label for legend. Defaults to “Key”.

  • caption (str, optional) – Optional caption for figure. Defaults to None.

  • lineWidth (float, optional) – Optional width of figure lines. Defaults to 2.

  • plotWidth (float, optional) – Optional overall width of figure. Defaults to 800.

  • plotHeight (float, optional) – Optional overall height of main figure. Defaults to 300.

  • plot2Height (float, optional) – Optional height of secondary figure. Defaults to 10% of main figure height.

  • show_tooltip (bool, optional) – Optionally show tooltip. Defaults to True.

Return type:

altair.Chart

wy_event_heatmap(df=typing.Union[pandas.core.frame.DataFrame, pandas.core.series.Series], criteria=1, y_title='Series', pass_label='Pass', fail_label='Fail', pass_colour='white', fail_colour='red', width=None, height=None, stroke='black', stroke_width=0.3) Chart

Returns an Altair heatmap chart from a timeseries input of event count by Water Year.

Parameters:
  • df (DataFrame | Series) – Annual (WY) index timeseries of no. of ‘events’ in a year i.e. output of StorageLevelAssessment.AnnualDaysBelowSummary()

  • criteria (int, optional) – Minimum integer in df that triggers a ‘failure’. Defaults to 1.

  • y_title (str, optional) – Y axis title. Defaults to “Series”.

  • pass_label (str, optional) – Label for years that don’t meet the criteria. Defaults to “Pass”.

  • fail_label (str, optional) – Label for years that meet the criteria. Defaults to “Fail”.

  • pass_colour (str, optional) – Colour for years that don’t meet the criteria. Defaults to “white”.

  • fail_colour (str, optional) – Colour for years that meet the criteria. Defaults to “red”.

  • width (int, optional) – Width of chart output. Defaults to None.

  • height (int, optional) – Height of chart output. Defaults to None.

  • stroke (str, optional) – Colour of rectangle outline. Defaults to black.

  • strokeWidth (float, optional) – Width of rectangle outline. Defaults to 0.3.

Return type:

altair.Chart