mario.Database.plot_matrix

Database.plot_matrix(matrix, x, color, y='Value', item='Sector', facet_row=None, facet_col=None, animation_frame='Scenario', base_scenario=None, path=None, mode='stack', layout=None, auto_open=True, shared_yaxes='all', shared_xaxes=True, **filters)

Generates a general html barplot giving the user certain degrees of freedom such as:

  • Regions (both the ones on the indices and columns)

  • Sectors/Commodities/Activities (both the ones on the indices and columns)

  • Scenarios

  • Units

Parameters:
  • matrix (str) –

    Matrix to be plotted. Three families of matrix can be read according to their intrinsic structure:

    1. The first family includes only matrix ‘X’, which has 3 levels of indices and 1 level of columns

    2. The second family includes matrices ‘Z’,’z’,’U’,’u’,’S’,’s’,’Y’, which have 3 levels of indices and 3 levels of columns

    3. The third family includes matrices ‘E’,’e’,’V’,’v’,’EY’, which have 1 level of indices and 3 levels of columns

  • path (str) – Path where to save the html file

  • x (str) – Degree of freedom to be showed on the x axis. Acceptable options change according to the matrix family

  • y (str) – Degree of freedom to be showed on the y axis. Default y=’Value’. Acceptable options change according to the matrix family

  • item (str) – Indicates the main level to be plot. Possible options are “Commodity”,”Activity” for SUT tables and “Sector” for IOT tables. It is mandatory to be defined only for SUT tables. For “Z”,”z”,”U”,”u”,”S”,”s”,”Y”,”X”, it selects the rows level between ‘Activity’ and ‘Commodity’. For “V”,”v”,”E”,”e”,”EY”,”M”,”F”, it selectes the columns level between ‘Activity’ and ‘Commodity’.

  • facet_row – String referring to one level of indices of the given matrix. Values from this column or array_like are used to assign marks to facetted subplots in the vertical direction

  • facet_col – String referring to one level of indices of the given matrix. Values from this column or array_like are used to assign marks to facetted subplots in the horizontal direction

  • animation_frame – Defines whether to switch from one scenario to the others by means of sliders

  • base_scenario (str) – By setting None, the passed matrix will be displayed for each scenario available. By setting this parameter equal to one of the scenarios available, the passed matrix will be displayed in terms of difference with respect to each of the other scenarios. In this last case, the selected scenario will not be displayed

  • mode (str) – Equivalent to plotly.grap_object.figure.update_layout barmode. Determines how bars at the same location coordinate are displayed on the graph. * With “stack”, the bars are stacked on top of one another * With “relative”, the bars are stacked on top of one another * With “group”, the bars are plotted next to one another centered around the shared location. * With “overlay”, the bars are plotted over one another, you might need to an “opacity” to see multiple bars.

  • auto_open (boolean) – if True, it opens automatically the saved file in the default html reader application

  • filters (dict) –

    The user has the option to filter the sets according to the necessity. Acceptable options are the following and must be provided as list:

    • ’filter_Region_from’,

    • ’filter_Region_to’,

    • ’filter_Sector_from’,

    • ’filter_Sector_to’,

    • ’filter_Consumption category’,

    • ’filter_Activity’,

    • ’filter_Commodity’