mario.Database.plot#

Database.plot(matrix=None, data=None, scenarios='baseline', base_scenario=None, difference='absolute', preset='overview', kind=None, x=None, y='Value', color=None, size=None, facet_row=None, facet_col=None, animation_frame=None, hover_name=None, hover_data=None, line_group=None, text=None, path_columns=None, filters=None, item=None, agg='sum', top_n=None, path=None, auto_open=True, layout=None, barmode='relative', log_x=False, log_y=False, title=None, return_data=False, **kwargs)#

Build one interactive plot from a matrix or a prepared dataframe.

Parameters:
  • matrix – Matrix name to resolve, flatten and plot.

  • data – Optional already-flat dataframe. Use this for custom derived views.

  • scenarios – Scenario name or iterable of scenario names. Used only with matrix=....

  • base_scenario – Optional reference scenario used to plot scenario differences.

  • difference – Difference mode used with base_scenario. Accepted values are "absolute" and "relative".

  • preset – Convenience preset for the non-expert workflow. Accepted values are "overview", "composition", "trend", "heatmap", "treemap" and "sunburst".

  • kind – Plotly Express chart type. When omitted, MARIO infers a sensible default from preset.

  • mappings – Standard Plotly Express mappings used in the advanced workflow. This includes x, y, color, size, facet_row, facet_col, animation_frame, hover_name, hover_data, line_group and text.

  • path_columns – Hierarchy columns for treemap and sunburst plots.

  • filters – Column filters applied after flattening. Example: {"Region_from": ["IT"], "Sector_to": ["Food"]}.

  • item – Optional shorthand filter applied on Level_from and Level_to when the selected matrix carries activity/commodity or sector semantics.

  • agg – Aggregation applied before plotting.

  • top_n – Optional cap on the number of x categories kept in the plot.

  • path – Output HTML path. Pass False to skip HTML export.

  • auto_open – When True, open the generated HTML plot automatically.

  • layout – Optional Plotly layout overrides.

  • barmode – Bar stacking mode used for bar plots.

  • log_x – Whether to use logarithmic scaling.

  • log_y – Whether to use logarithmic scaling.

  • title – Optional plot title.

  • return_data – When True, return (figure, plotted_dataframe).

  • **kwargs – Additional keyword arguments forwarded to Plotly Express.

Returns:

The generated figure, or (figure, plotted_dataframe) when return_data=True.

Return type:

plotly.graph_objects.Figure | tuple