.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples\tutorial\plot_sample_01.py" .. LINE NUMBERS ARE GIVEN BELOW. .. 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__examples_tutorial_plot_sample_01.py: Plotting a gaussian (script) ============================ Example ``matplotlib`` to plot a gaussian. .. GENERATED FROM PYTHON SOURCE LINES 8-37 .. image:: /_examples/tutorial/images/sphx_glr_plot_sample_01_001.png :alt: plot sample 01 :class: sphx-glr-single-img .. code-block:: default :lineno-start: 8 # Libraries import numpy as np import matplotlib.pyplot as plt # --------------------------- # Methods # --------------------------- def gaussian(x, mu=0, sig=1): return np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.))) # --------------------------- # Configuration # --------------------------- # --------------------------- # Main # --------------------------- # Load data x = np.linspace(-3, 3, 120) y = gaussian(x) # Plot plt.plot(x, y) # Show plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.308 seconds) .. _sphx_glr_download__examples_tutorial_plot_sample_01.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_sample_01.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_sample_01.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_