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

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)