Skip to content

Instantly share code, notes, and snippets.

@andersx
Created November 9, 2013 14:13
Show Gist options
  • Save andersx/7385821 to your computer and use it in GitHub Desktop.
Save andersx/7385821 to your computer and use it in GitHub Desktop.
import pylab
import numpy
import os
# Make a simple plot
x = numpy.arange(1, 100, 1)
y = x**2
pylab.plot(x, y)
# Define a filename (remember the .pdf)
filename = "my_file.pdf"
# Save and convert!
pylab.savefig(filename)
os.system("pdfcrop %s %s" % (filename, filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment