You are reading an old version of the documentation (v1.4.3). For the latest version see https://matplotlib.org/stable/

We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates

matplotlib

Previous topic

pylab_examples example code: polar_legend.py

Next topic

pylab_examples example code: psd_demo.py

This Page

pylab_examples example code: print_stdout.pyΒΆ

[source code]

#!/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 Search examples)