File: print_stdout.py

package info (click to toggle)
matplotlib 2.0.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 91,640 kB
  • ctags: 29,525
  • sloc: python: 122,697; cpp: 60,806; ansic: 30,799; objc: 2,830; makefile: 224; sh: 85
file content (15 lines) | stat: -rw-r--r-- 296 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# -*- 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])

if sys.version_info[0] >= 3:
    plt.savefig(sys.stdout.buffer)
else:
    plt.savefig(sys.stdout)