.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_plot_command_line_args.py>`     to download the full example code
    .. rst-class:: sphx-glr-example-title

    .. _sphx_glr_auto_examples_plot_command_line_args.py:


Command line arguments support
==============================

Use command line arguments to control example script.



.. image:: /auto_examples/images/sphx_glr_plot_command_line_args_001.png
    :alt: plot command line args
    :class: sphx-glr-single-img






.. code-block:: python3


    import sys

    import numpy as np
    import matplotlib.pyplot as plt

    if len(sys.argv) > 1 and sys.argv[1] == 'plot':
        fig_0, ax_0 = plt.subplots(figsize=(5, 1))

        x = np.arange(0, 10., 1)
        ax_0.plot(x, x**2)
        plt.show()


.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_auto_examples_plot_command_line_args.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_command_line_args.py <plot_command_line_args.py>`



  .. container:: sphx-glr-download sphx-glr-download-jupyter

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


.. only:: html

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

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