
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/misc/print_stdout_sgskip.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

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

        :ref:`Go to the end <sphx_glr_download_gallery_misc_print_stdout_sgskip.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_misc_print_stdout_sgskip.py:


=====================
Print image to stdout
=====================

print png to standard out

usage: python print_stdout.py > somefile.png

.. GENERATED FROM PYTHON SOURCE LINES 11-21

.. code-block:: Python


    import sys

    import matplotlib

    matplotlib.use('Agg')
    import matplotlib.pyplot as plt

    plt.plot([1, 2, 3])
    plt.savefig(sys.stdout.buffer)


.. _sphx_glr_download_gallery_misc_print_stdout_sgskip.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

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

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

    .. container:: sphx-glr-download sphx-glr-download-python

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

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: print_stdout_sgskip.zip <print_stdout_sgskip.zip>`


.. only:: html

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

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