.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_meta_modeling/polynomial_chaos_metamodel/plot_functional_chaos_graphs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` 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 ======================= .. GENERATED FROM PYTHON SOURCE LINES 6-8 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. .. GENERATED FROM PYTHON SOURCE LINES 10-17 .. code-block:: Python import openturns as ot import openturns.viewer as viewer from matplotlib import pylab as plt ot.Log.Show(ot.Log.NONE) .. GENERATED FROM PYTHON SOURCE LINES 18-46 .. code-block:: Python 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 fulfilled # with curves graphJacobi = ot.Graph(titleJacobi, "z", "polynomial values", True, "upper right") # 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 .. GENERATED FROM PYTHON SOURCE LINES 47-48 Draw the 5-th first members of the Jacobi family. .. GENERATED FROM PYTHON SOURCE LINES 50-52 Create the Jacobi polynomials family using the default Jacobi.ANALYSIS parameter set .. GENERATED FROM PYTHON SOURCE LINES 52-58 .. code-block:: Python alpha = 0.5 beta = 1.5 jacobiFamily = ot.JacobiFactory(alpha, beta) graph = drawFamily(jacobiFamily) view = viewer.View(graph) .. image-sg:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_001.png :alt: Jacobi polynomials :srcset: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 59-63 .. code-block:: Python laguerreFamily = ot.LaguerreFactory(2.75, 1) graph = drawFamily(laguerreFamily) view = viewer.View(graph) .. image-sg:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_002.png :alt: Laguerre polynomials :srcset: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 64-67 .. code-block:: Python graph = drawFamily(ot.HermiteFactory()) view = viewer.View(graph) plt.show() .. image-sg:: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_003.png :alt: Hermite polynomials :srcset: /auto_meta_modeling/polynomial_chaos_metamodel/images/sphx_glr_plot_functional_chaos_graphs_003.png :class: sphx-glr-single-img .. _sphx_glr_download_auto_meta_modeling_polynomial_chaos_metamodel_plot_functional_chaos_graphs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_functional_chaos_graphs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_functional_chaos_graphs.py `