Skip to content

Instantly share code, notes, and snippets.

@shreyankg
Created September 27, 2010 05:13
Show Gist options
  • Save shreyankg/598648 to your computer and use it in GitHub Desktop.
Save shreyankg/598648 to your computer and use it in GitHub Desktop.
import matplotlib
matplotlib.use('Agg')
import numpy as np
from math import pi
import matplotlib.pyplot as plt
hash = {
1: 'c',
2: 'b',
4: 'r',
8: 'g',
}
x = np.arange(0, 2, 0.001);
w = np.arange(0, 2, 1.0/8)
for key, color in hash.iteritems():
plt.clf()
y = np.sin(2*pi*x*key)
z = np.sin(2*pi*w*key)
plt.plot(x, y, color=color, label='%d MHz' % key)
#plt.plot(w, z, 'ko')
plt.xlabel('time (in microsecond)')
plt.legend()
plt.savefig('%dMHz-unsampled.png' % key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment