View¶
(Source code
, png
)
- class View(graph, pixelsize=None, figure=None, figure_kw=None, axes=[], plot_kw=None, axes_kw=None, bar_kw=None, pie_kw=None, polygon_kw=None, polygoncollection_kw=None, contour_kw=None, step_kw=None, clabel_kw=None, scatter_kw=None, text_kw=None, legend_kw=None, add_legend=True, square_axes=False, **kwargs)¶
Create the figure.
- Parameters:
- graph
Graph
,Drawable
orGridLayout
An object to draw.
- pixelsize2-tuple of int
The requested size in pixels (width, height).
- figure
matplotlib.figure.Figure
The figure to draw on.
- figure_kwdict, optional
Passed on to matplotlib.pyplot.figure kwargs
- axes
matplotlib.axes.Axes
The axes to draw on.
- plot_kwdict, optional
Used when drawing Curve drawables Passed on as matplotlib.axes.Axes.plot kwargs
- axes_kwdict, optional
Passed on to matplotlib.figure.Figure.add_subplot kwargs
- bar_kwdict, optional
Used when drawing BarPlot drawables Passed on to matplotlib.pyplot.bar kwargs
- pie_kwdict, optional
Used when drawing Pie drawables Passed on to matplotlib.pyplot.pie kwargs
- polygon_kwdict, optional
Used when drawing Polygon drawables Passed on to matplotlib.patches.Polygon kwargs
- polygoncollection_kwdict, optional
Used when drawing PolygonArray drawables Passed on to matplotlib.collection.PolygonCollection kwargs
- contour_kwdict, optional
Used when drawing Contour drawables Passed on to matplotlib.pyplot.contour kwargs
- clabel_kwdict, optional
Used when drawing Contour drawables Passed on to matplotlib.pyplot.clabel kwargs
- scatter_kwdict, optional
Used when drawing Cloud drawables Passed on to matplotlib.pyplot.scatter kwargs
- step_kwdict, optional
Used when drawing Staircase drawables Passed on to matplotlib.pyplot.step kwargs
- text_kwdict, optional
Used when drawing Pairs, Text drawables Passed on to matplotlib.axes.Axes.text kwargs
- legend_kwdict, optional
Passed on to matplotlib.axes.Axes.legend kwargs
- add_legendbool, optional
Adds a legend if True. Default is True.
- square_axesbool, optional
Forces the axes to share the same scale if True. Default is False.
- graph
Methods
ShowAll
(**kwargs)Display all graphs.
close
()Close the figure.
getAxes
()Get the matrix of Axes objects if the graph is a GridLayout, the list of Axes objects otherwise.
Get the list of QuadContourSet objects.
Accessor to the underlying figure object.
Get the matrix of View objects if the graph is GridLayout, None otherwise.
save
(fname, **kwargs)Save the graph as file.
show
(**kwargs)Display the graph.
Examples
>>> import openturns as ot >>> from openturns.viewer import View >>> graph = ot.Normal().drawPDF() >>> view = View(graph, plot_kw={'color':'blue'}) >>> view.save('graph.png', dpi=100) >>> view.show()
- __init__(graph, pixelsize=None, figure=None, figure_kw=None, axes=[], plot_kw=None, axes_kw=None, bar_kw=None, pie_kw=None, polygon_kw=None, polygoncollection_kw=None, contour_kw=None, step_kw=None, clabel_kw=None, scatter_kw=None, text_kw=None, legend_kw=None, add_legend=True, square_axes=False, **kwargs)¶
- static ShowAll(**kwargs)¶
Display all graphs.
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> n = ot.Normal() >>> graph = n.drawPDF() >>> view = otv.View(graph) >>> u = ot.Uniform() >>> graph = u.drawPDF() >>> view = otv.View(graph) >>> otv.View.ShowAll()
- close()¶
Close the figure.
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> n = ot.Normal() >>> graph = n.drawPDF() >>> view = otv.View(graph) >>> view.close()
- getAxes()¶
Get the matrix of Axes objects if the graph is a GridLayout, the list of Axes objects otherwise.
See matplotlib.axes.Axes for further information.
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> n = ot.Normal() >>> graph = n.drawPDF() >>> view = otv.View(graph) >>> axes = view.getAxes() >>> _ = axes[0].set_ylim(-0.1, 1.0);
- getContourSets()¶
Get the list of QuadContourSet objects.
See matplotlib.contour.QuadContourSet for further information.
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> f = ot.SymbolicFunction(['x', 'y'], ['exp(-sin(cos(y)^2*x^2+sin(x)^2*y^2))']) >>> view = otv.View(f.draw([0.,0.],[10.,10.],[50]*2)) >>> contoursets = view.getContourSets() >>> colorbar = view.getFigure().colorbar(contoursets[0]);
- getFigure()¶
Accessor to the underlying figure object.
See matplotlib.figure.Figure for further information.
Examples
>>> import openturns as ot >>> from openturns.viewer import View >>> graph = ot.Normal().drawPDF() >>> view = View(graph) >>> fig = view.getFigure() >>> _ = fig.suptitle("The suptitle");
- getSubviews()¶
Get the matrix of View objects if the graph is GridLayout, None otherwise.
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> f = ot.SymbolicFunction(['x', 'y'], ['exp(-sin(cos(y)^2*x^2+sin(x)^2*y^2))']) >>> grid = ot.GridLayout(1, 2) >>> grid.setGraphCollection(ot.graph._GraphCollection([f.draw(0, 0, [0., 0.], 0., 10., 50), f.draw([0., 0.], [10., 10.], [50]*2)])) >>> view = otv.View(grid) >>> colorbar = view.getFigure().colorbar(view.getSubviews()[0][1].getContourSets()[0])
- save(fname, **kwargs)¶
Save the graph as file.
- Parameters:
- fnamebool, optional
A string containing a path to a filename from which file format is deduced.
- kwargsdict
See matplotlib.figure.Figure.savefig documentation for valid keyword arguments.
Examples
>>> import openturns as ot >>> from openturns.viewer import View >>> graph = ot.Normal().drawPDF() >>> view = View(graph) >>> view.save('graph.png', dpi=100)
- show(**kwargs)¶
Display the graph.
See matplotlib.figure.Figure.show
Examples
>>> import openturns as ot >>> import openturns.viewer as otv >>> n = ot.Normal() >>> graph = n.drawPDF() >>> view = otv.View(graph) >>> view.show()
Examples using the class¶
Build and validate a linear model
Estimate correlation coefficients
Compare unconditional and conditional histograms
Compute squared SRC indices confidence intervals
Define a distribution from quantiles
Model a singular multivariate distribution
Get the asymptotic distribution of the estimators
Estimate a GEV on the Venice sea-levels data
Bandwidth sensitivity in kernel smoothing
Fit an extreme value distribution
Estimate a conditional quantile
Estimate a GPD on the Wooster temperature data
Estimate a GPD on the Dow Jones Index data
Fit a non parametric distribution
Estimate a GEV on the Port Pirie sea-levels data
Estimate a GPD on the daily rainfall data
Estimate a GEV on race times data
Estimate a GEV on the Fremantle sea-levels data
Kolmogorov-Smirnov : understand the statistics
Kolmogorov-Smirnov : understand the p-value
Kolmogorov-Smirnov : get the statistics distribution
Estimate tail dependence coefficients on the wave-surge data
Estimate tail dependence coefficients on the wind data
Estimate a non stationary covariance function
Estimate a spectral density function
Estimate a stationary covariance function
Visualize pairs between two samples
Create the distribution of the maximum of independent distributions
Create a maximum entropy statistics distribution
Create a conditional distribution
Create your own distribution given its quantile function
Create an extreme value distribution
Create and draw scalar distributions
Generate random variates by inverting the CDF
Overview of univariate distribution management
Quick start guide to distributions
Create a customized distribution or copula
Create a mixture of distributions
Create and draw multivariate distributions
Draw minimum volume level sets
Create the ordinal sum of copulas
Create a functional basis process
Use the Box-Cox transformation
Create a stationary covariance model
Create a custom covariance model
Create a process from random vectors and processes
Sample trajectories from a Gaussian Process with correlated outputs
Create a discrete Markov chain process
Create and manipulate an ARMA process
Create a linear least squares model
Create a general linear model metamodel
Distribution of estimators in linear regression
Over-fitting and model selection
Create a polynomial chaos metamodel by integration on the cantilever beam
Create a polynomial chaos metamodel from a data set
Create a polynomial chaos for the Ishigami function: a quick start guide to polynomial chaos
Polynomial chaos is sensitive to the degree
Create a sparse chaos by integration
Compute Sobol’ indices confidence intervals
Conditional expectation of a polynomial chaos expansion
Polynomial chaos expansion cross-validation
Kriging : multiple input dimensions
Kriging: propagate uncertainties
Kriging : cantilever beam model
Gaussian Process Regression : cantilever beam model
Example of multi output Kriging on the fire satellite model
Kriging : generate trajectories from a metamodel
Kriging: choose a polynomial trend on the beam model
Kriging: metamodel of the Branin-Hoo function
Gaussian Process Regression : quick-start
Sequentially adding new points to a Kriging
Kriging: choose a polynomial trend
Kriging : draw covariance models
Validation of a Karhunen-Loeve decomposition
Viscous free fall: metamodel of a field function
Evaluate the mean of a random vector by simulations
Analyse the central tendency of a cantilever beam
Estimate moments from Taylor expansions
Use the Directional Sampling Algorithm
Estimate a flooding probability
Use the Importance Sampling algorithm
Estimate a probability with Monte-Carlo on axial stressed beam: a quick start guide to reliability
Estimate a buckling probability
Exploitation of simulation algorithm results
Use the FORM algorithm in case of several design points
Use the FORM - SORM algorithms
Non parametric Adaptive Importance Sampling (NAIS)
Time variant system reliability problem
Create unions or intersections of events
Axial stressed beam : comparing different methods to estimate a probability
Cross Entropy Importance Sampling
An illustrated example of a FORM probability estimate
Estimate a process-based event probability
Estimate Sobol indices on a field to point function
Sobol’ sensitivity indices using rank-based algorithm
Estimate Sobol’ indices for the beam by simulation algorithm
Parallel coordinates graph as sensitivity tool
Estimate Sobol’ indices for a function with multivariate output
Sobol’ sensitivity indices from chaos
The HSIC sensitivity indices: the Ishigami model
Example of sensitivity analyses on the wing weight model
Create a composite design of experiments
Create a Monte Carlo design of experiments
Probabilistic design of experiments
Create a random design of experiments
Create mixed deterministic and probabilistic designs of experiments
Create a design of experiments with discrete and continuous variables
Deterministic design of experiments
Create a deterministic design of experiments
Generate low discrepancy sequences
Optimize an LHS design of experiments
Merge nodes in Smolyak quadrature
Define a connection function with a field output
Define a function with a field output: the viscous free fall example
Create a process sample from a sample
Generate flooding model observations
Calibrate a parametric model: a quick-start guide to calibration
Generate observations of the Chaboche mechanical model
Calibration without observed inputs
Calibration of the logistic model
Calibration of the deflection of a tube
Calibration of the flooding model
Calibration of the Chaboche mechanical model
Gibbs sampling of the posterior distribution
Sampling from an unnormalized probability density
Posterior sampling using a PythonDistribution
Bayesian calibration of a computer code
Bayesian calibration of the flooding model
Customize your Metropolis-Hastings algorithm
Linear Regression with interval-censored observations
Bayesian calibration of hierarchical fission gas release models
Integrate a function with Gauss-Kronrod algorithm
Estimate a multivariate integral with IteratedQuadrature
Compute leave-one-out error of a polynomial chaos expansion
Compute confidence intervals of a regression model from data
Compute confidence intervals of a univariate noisy function
Multi-objective optimization using Pagmo
Quick start guide to optimization
Optimization of the Rastrigin test function
EfficientGlobalOptimization examples
Estimate threshold exceedance iteratively
Plot the log-likelihood contours of a distribution
A quick start guide to contours