View¶
(Source code
, svg
)
- 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, colorbar_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
- colorbar_kwdict, optional
Passed on to matplotlib.figure.Figure.colorbar 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, colorbar_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¶
Linear Regression with interval-censored observations
Bayesian calibration of hierarchical fission gas release models
Calibrate a parametric model: a quick-start guide to calibration
Generate observations of the Chaboche mechanical model
Estimate tail dependence coefficients on the wave-surge data
Estimate tail dependence coefficients on the wind data
Kolmogorov-Smirnov : get the statistics distribution
Define a function with a field output: the viscous free fall example
Plot the log-likelihood contours of a distribution
Gaussian Process Regression: multiple input dimensions
Gaussian Process-based active learning for reliability
Gaussian Process Regression: choose a polynomial trend on the beam model
Gaussian Process Regression : cantilever beam model
Gaussian Process Regression: choose a polynomial trend
Gaussian Process Regression : generate trajectories from the metamodel
Gaussian Process Regression: metamodel of the Branin-Hoo function
Example of multi output Gaussian Process Regression on the fire satellite model
Sequentially adding new points to a Gaussian Process metamodel
Gaussian Process Regression: propagate uncertainties
Create a polynomial chaos metamodel by integration on the cantilever beam
Conditional expectation of a polynomial chaos expansion
Create a polynomial chaos for the Ishigami function: a quick start guide to polynomial chaos
Create a polynomial chaos metamodel from a data set
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
Create your own distribution given its quantile function
Create a maximum entropy order statistics distribution
Create the distribution of the maximum of distributions
Compute the joint distribution of order statistics
Use the Ratio of Uniforms algorithm to sample a distribution
Sample trajectories from a Gaussian Process with correlated outputs
Create a process from random vectors and processes
Evaluate the mean of a random vector by simulations
Create a design of experiments with discrete and continuous variables
Create mixed deterministic and probabilistic designs of experiments
Axial stressed beam : comparing different methods to estimate a probability
Estimate a probability with Monte-Carlo on axial stressed beam: a quick start guide to reliability
An illustrated example of a FORM probability estimate
Use the FORM algorithm in case of several design points
Non parametric Adaptive Importance Sampling (NAIS)
Estimate Sobol indices on a field to point function
Sobol’ sensitivity indices using rank-based algorithm
Estimate Sobol’ indices for a function with multivariate output
Estimate Sobol’ indices for the beam by simulation algorithm
Example of sensitivity analyses on the wing weight model