

.. _sphx_glr_gallery_lines_bars_and_markers_simple_plot.py:


===========
Simple Plot
===========

Create a simple plot.




.. image:: /gallery/lines_bars_and_markers/images/sphx_glr_simple_plot_001.png
    :align: center





.. code-block:: python

    import matplotlib.pyplot as plt
    import numpy as np

    # Data for plotting
    t = np.arange(0.0, 2.0, 0.01)
    s = 1 + np.sin(2 * np.pi * t)

    # Note that using plt.subplots below is equivalent to using
    # fig = plt.figure and then ax = fig.add_subplot(111)
    fig, ax = plt.subplots()
    ax.plot(t, s)

    ax.set(xlabel='time (s)', ylabel='voltage (mV)',
           title='About as simple as it gets, folks')
    ax.grid()

    fig.savefig("test.png")
    plt.show()

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



.. only :: html

 .. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

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