

.. _sphx_glr_auto_examples_sin_func_plot_sin.py:


Plotting simple sin function
============================

A simple example of the plot of a sin function
in order to test the autonomy of the gallery.

To illustrate how to insert maths in example descriptions,
it corresponds mathematically to the function:

.. math::

    x \rightarrow \sin(x)

Here the function :math:`\sin` is evaluated at each point the variable
:math:`x` is defined.

Note that ``sphinx-gallery`` automatically creates labels for each example from
its filename. You can thus refer to it from any part of the documentation,
including from other examples, as here

.. seealso::
    :ref:`sphx_glr_auto_examples_sin_func_plot_sin_black_background.py` for a
    fancier plot




.. image:: /auto_examples/sin_func/images/sphx_glr_plot_sin_001.png
    :align: center





.. code-block:: python


    # Code source: Óscar Nájera
    # License: BSD 3 clause

    import numpy as np
    import matplotlib.pyplot as plt

    x = np.linspace(0, 2 * np.pi, 100)
    y = np.sin(x)

    plt.plot(x, y)
    plt.xlabel('$x$')
    plt.ylabel('$\sin(x)$')
    plt.show()

**Total running time of the script:** ( 0 minutes  0.104 seconds)



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

     :download:`Download Python source code: plot_sin.py <plot_sin.py>`



  .. container:: sphx-glr-download

     :download:`Download Jupyter notebook: plot_sin.ipynb <plot_sin.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
