.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_auto_meta_modeling_polynomial_chaos_metamodel_plot_functional_chaos_graphs.py:
Polynomial chaos graphs
=======================
In this example we are going to create some graphs useful after the launch of a polynomial chaos algorithm.
More precisely, we draw some members of the 1D polynomial family.
.. code-block:: default
from __future__ import print_function
import openturns as ot
import openturns.viewer as viewer
from matplotlib import pylab as plt
ot.Log.Show(ot.Log.NONE)
.. code-block:: default
def drawFamily(factory, degreeMax=5):
# Load all the valid colors
colorList = ot.Drawable.BuildDefaultPalette(degreeMax)
# Create a fine title
titleJacobi = factory.__class__.__name__.replace('Factory', '') + " polynomials"
# Create an empty graph which will be fullfilled
# with curves
graphJacobi = ot.Graph(titleJacobi, "z", "polynomial values", True, "topright")
# Fix the number of points for the graph
pointNumber = 101
# Bounds of the graph
xMinJacobi = -1.0
xMaxJacobi = 1.0
# Get the curves
for i in range(degreeMax):
graphJacobi_temp = factory.build(i).draw(
xMinJacobi, xMaxJacobi, pointNumber)
graphJacobi_temp_draw = graphJacobi_temp.getDrawable(0)
graphJacobi_temp_draw.setLegend("degree " + str(i))
graphJacobi_temp_draw.setColor(colorList[i])
graphJacobi.add(graphJacobi_temp_draw)
return graphJacobi
Draw the 5-th first members of the Jacobi family.
Create the Jacobi polynomials family using the default Jacobi.ANALYSIS
parameter set
.. code-block:: default
alpha = 0.5
beta = 1.5
jacobiFamily = ot.JacobiFactory(alpha, beta)
graph = drawFamily(jacobiFamily)
view = viewer.View(graph)
.. image:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_001.png
:alt: Jacobi polynomials
:class: sphx-glr-single-img
.. code-block:: default
laguerreFamily = ot.LaguerreFactory(2.75, 1)
graph =drawFamily(laguerreFamily)
view = viewer.View(graph)
.. image:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_002.png
:alt: Laguerre polynomials
:class: sphx-glr-single-img
.. code-block:: default
graph = drawFamily(ot.HermiteFactory())
view = viewer.View(graph)
plt.show()
.. image:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_003.png
:alt: Hermite polynomials
:class: sphx-glr-single-img
.. rst-class:: sphx-glr-timing
**Total running time of the script:** ( 0 minutes 0.295 seconds)
.. _sphx_glr_download_auto_meta_modeling_polynomial_chaos_metamodel_plot_functional_chaos_graphs.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_functional_chaos_graphs.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_functional_chaos_graphs.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery `_