.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_data_analysis/statistical_tests/plot_qqplot_graph.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_data_analysis_statistical_tests_plot_qqplot_graph.py: Draw the QQ-Plot ================ .. GENERATED FROM PYTHON SOURCE LINES 7-8 In this example we are going to perform a visual goodness-of-fit test for an 1-d distribution with the QQ plot. .. GENERATED FROM PYTHON SOURCE LINES 10-16 .. 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 17-18 Create data .. GENERATED FROM PYTHON SOURCE LINES 18-23 .. code-block:: Python ot.RandomGenerator.SetSeed(0) distribution = ot.Gumbel(0.2, 0.5) sample = distribution.getSample(100) sample.setDescription(["Sample"]) .. GENERATED FROM PYTHON SOURCE LINES 24-25 Fit a distribution .. GENERATED FROM PYTHON SOURCE LINES 25-27 .. code-block:: Python distribution = ot.GumbelFactory().build(sample) .. GENERATED FROM PYTHON SOURCE LINES 28-29 Draw QQ plot .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: Python graph = ot.VisualTest.DrawQQplot(sample, distribution) view = viewer.View(graph) .. image-sg:: /auto_data_analysis/statistical_tests/images/sphx_glr_plot_qqplot_graph_001.png :alt: Sample versus model QQ-plot :srcset: /auto_data_analysis/statistical_tests/images/sphx_glr_plot_qqplot_graph_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-34 Incorrect proposition .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: Python graph = ot.VisualTest.DrawQQplot(sample, ot.WeibullMin()) view = viewer.View(graph) plt.show() .. image-sg:: /auto_data_analysis/statistical_tests/images/sphx_glr_plot_qqplot_graph_002.png :alt: Sample versus model QQ-plot :srcset: /auto_data_analysis/statistical_tests/images/sphx_glr_plot_qqplot_graph_002.png :class: sphx-glr-single-img .. _sphx_glr_download_auto_data_analysis_statistical_tests_plot_qqplot_graph.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_qqplot_graph.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_qqplot_graph.py `