Graph
This python file contains the code to plot a graph of the environnemental and social impacts: - class Parameters - plot_donut() - plot_type_1() - plot_type_2()
- class Graph.Parameters
This class contains the graphic’s parameters (Tkinter window, defined in main.py). It’s attributes are:
- self.mode :
(integer) « 1 » if specific stakeholder is checked, used to plot with plot_type_1(). « 2 » if multiple stakeholder is checked, used to plot with plot_type_2().
- self.ref_name :
(string) The name of the chosen reference.
- self.stakeholder :
(string) The name of the chosen stakeholder.
- self.scenario_name :
(string) The name of the chosen scenario.
- self.List_name :
(list of strings) Contains the name of each scenarios.
- self.error_shown :
(integer) parameter to decide which precision’s dimension errorbar use in the plotting. By default, it is on “0”, for Reliability of the source.
- self.output :
(pd.DataFrame) a panda Database containing database_endpoint_impact with two news columns: real impact on endpoints capabilities and their precision’s dimension value (dimension controlled by errorshown)
- Graph.plot_donut(df, ax, scenario, stakeholder, lim_in, lim_out, error, name)
The function generates a bar chart with the data supplied to it.
- Paramètres:
df (panda.dataFrame) – The pa.output database, from which to fetch the plotted values.
ax (matplotlib.axe) – the axis on which the graph is to be plotted.
scenario (str) – The name of the scenario to be plotted.
stakeholder (str) – The name of the stakeholder to be plotted.
lim_in (int) – Minimum value at the center of the donut.
lim_out (int) – Maximum value at the periphery of the donut.
error (tuple) – a tuple containing the boolean status of whether to hide or show errorbar in (tuple[0]) and errorbar out (tuple[1]).
name (str) – The name (of the scenario) to be displayed above the graph.
- Graph.plot_type_1(database_output, stakeholder, scenario_name)
The plot_type_1 function creates the interactive page that will host the Donut graph for the scenario and the of the scenario and the impacted part.
- Paramètres:
database_output (panda.dataFrame) – The pa.output database, from which to fetch the plotted values.
stakeholder (str) – The name of the stakeholder to be displayed.
scenario_name (str) – The name of the scenario being studied (its value is stored in self.stakeholder of a class Parameters)
- Graph.plot_type_2(database_output, scenario_name)
The plot_type_2() function creates the interactive page that will host the Donut graphs, for all 6 stakeholders, of the impacts on Endpoint capabilities on the scenario entered as a parameter.
- Paramètres:
database_output – The pa.output database, from which to fetch the plotted values.
scenario_name (str) – The name of the scenario studied (its value is stored in self.stakeholder of an object of class Parameters)