Created
January 19, 2017 12:58
-
-
Save windstriver/b84040ad680f18b0f33fad736f631600 to your computer and use it in GitHub Desktop.
A python script to save matplotlib plot to pdf file.
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_pdf import PdfPages | |
x = np.random.randn(1000) | |
fig = plt.figure() | |
ax = fig.add_subplot(1,1,1) | |
ax.hist(x, 100) | |
ax.set_title('Normal distribution with $\mu=0, \sigma=1$') | |
with PdfPages('foo.pdf') as pdf: | |
pdf.savefig(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment