Created
November 11, 2011 23:00
-
-
Save yangle/1359588 to your computer and use it in GitHub Desktop.
matplotlib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| from matplotlib.backends.backend_pdf import PdfPages | |
| import datetime | |
| infodict={'Author':'yAngle', | |
| 'CreationDate':datetime.datetime.today(), | |
| 'ModDate':datetime.datetime.today(), | |
| } | |
| fig=plt.figure(figsize=(3.4,2.2)) # 3.4 for RevTeX columnwidth, 2.2 ~ golden ratio | |
| lbwh=[0.17, 0.15, 0.80, 0.81] | |
| ax=fig.add_axes(lbwh) | |
| x=np.linspace(0,2*np.pi,21) | |
| ax.plot(x,np.sin(x)) | |
| if 1: | |
| fig.savefig('abc.pdf') | |
| plt.close() | |
| else: | |
| pdf=PdfPages('abc.pdf') | |
| d=dict(infodict) | |
| d['Title']='title' | |
| pdf.infodict().update(d) | |
| pdf.savefig(fig) | |
| plt.close() | |
| pdf.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment