You are reading an old version of the documentation (v1.5.1). 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

Travis-CI:

This Page

pylab_examples example code: print_stdout.pyΒΆ

[source code]

# -*- noplot -*-
# print png to standard out
# usage: python print_stdout.py > somefile.png

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

plt.plot([1, 2, 3])

plt.savefig(sys.stdout)
plt.show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)