Skip to content

Instantly share code, notes, and snippets.

@chirag-v
Last active December 14, 2015 02:19
Show Gist options
  • Save chirag-v/5012851 to your computer and use it in GitHub Desktop.
Save chirag-v/5012851 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
#Show how to make and save a simple line plot with labels, title and grid
#modified from matplotlib official tutorial @ http://www.scipy.org/Plotting_Tutorial
#Run directly on iPython shell
import numpy
import pylab
pylab.interactive(True)
pylab.show()
t = numpy.arange(0.0, 1.0+0.01, 0.01)
s = numpy.cos(2*2*numpy.pi*t)
pylab.plot(t, s)
pylab.xlabel('time (s)')
pylab.ylabel('voltage (mV)')
pylab.title('About as simple as it gets, folks')
pylab.grid(True)
pylab.savefig('simple_plot')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment