uncertaintylib.plot_functions¶
MIT License
Copyright (c) 2025 Equinor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Functions
|
Create a plot and table for a given property for a Monte Carlo run |
|
Plots the contribution of the input parameters to the total expanded uncertainty of a property. |
- uncertaintylib.plot_functions.montecarlo_property_plot_and_table(data, property_id, xlim=None, property_name='', property_unit='', case_title='', round_props=None)[source]¶
Create a plot and table for a given property for a Monte Carlo run
- Parameters:
data (pd.DataFrame) – A DataFrame with Monte Carlo data generated from the provided parameters. This is the output from the “monte_carlo_simulation” function in uncertainty_functions
property_id (str) – Property to plot, which needs to correspond to the column heading in the Monte Carlo results.
xlim (list, optional) – List containing percentage range of the property to plot. For example, [-2, 2] means the plot will plot from the mean-2 % to mean + 2 %, by default [].
property_name (str, optional) – The name to be used in titles in the plot. Defaults to ‘’, which will use the property_id as the property_name.
property_unit (str, optional) – Unit to be displayed in plots, defaults to ‘’.
round_props (dict, optional) – Dictionary determining how the mean and standard deviations in the table should be rounded. Default is {‘mean’: 1, ‘std’: 2, ‘stdperc’: 2}.
case_title (str, optional) – Title displayed above the plot. Default is generated based on the property name
- Returns:
matplotlib.figure.Figure – The generated figure.
- Return type:
Figure
- uncertaintylib.plot_functions.plot_uncertainty_contribution(res, property_id, plot_title='', filter_top_x=0)[source]¶
Plots the contribution of the input parameters to the total expanded uncertainty of a property.
- Parameters:
res (dict) – A dictionary that contains the uncertainty calculation results. This is the output from the “calculate_uncertainty” function in uncertainty_functions
property_id (str) – A string that corresponds to the id of the property to plot.
plot_title (str) – Title of the plot, Optional. If left empty, the plot will generate a standard plot title If plot_title is set to None, plot title is not included
filter_top_x (bool) – For uncertainty results with large number of outputs, it can be convenient to filter out the top contributors to uncertainty. If filter_top_x is 0, all contributors will be included. If it is set to a number, the function will retrieve the X numbers of top contributors and only include theses in the plot.
- Returns:
matplotlib.figure.Figure – A Figure object that contains the plot.
- Return type:
Figure