python - How can I print a plot in matplotlib either from the plot window or with a command? -
is there way print plot matplotlib,either command or plot window ? know save , print,but looking more automated.thanks.
you save figure pdf, use subprocess
print pdf. on *nix, lpr
used:
import matplotlib.pyplot plt import numpy np import subprocess import shlex n=20 x=np.linspace(0,np.pi,n) y=np.sin(x) plt.plot(x,y) fname='/tmp/test.pdf' plt.savefig(fname) proc=subprocess.popen(shlex.split('lpr {f}'.format(f=fname)))
Comments
Post a Comment