.. _pylab_examples-print_stdout:

pylab_examples example code: print_stdout.py
============================================

[`source code <print_stdout.py>`_]

::

    #!/usr/bin/env python
    # -*- noplot -*-
    # print png to standard out
    # usage: python print_stdout.py > somefile.png
    import sys
    import matplotlib
    matplotlib.use('Agg')
    from pylab import *
    
    plot([1,2,3])
    
    savefig(sys.stdout)
    show()
    

Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)