Skip to content

Instantly share code, notes, and snippets.

@wiless
Last active March 9, 2020 04:38
Show Gist options
  • Save wiless/e76cdbecf4307b7dd08de5a11c907bc2 to your computer and use it in GitHub Desktop.
Save wiless/e76cdbecf4307b7dd08de5a11c907bc2 to your computer and use it in GitHub Desktop.
Short reference file for plotting
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
#
# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
#t=[0,1,2,4] # Note always have ","
#h=[.3,0.4,.3]
fig, ax = plt.subplots()
ax.plot(t, s)
ax.set(xlabel='time (s)', ylabel='voltage (mV)',
title='About as simple as it gets, folks')
ax.grid()
fig.savefig("test.png")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment