draw function matplotlib code example
Example 1: how to plot a graph using matplotlib
from matplotlib import pyplot as plt
plt.plot([0, 1, 2, 3, 4, 5], [0, 1, 4, 9, 16, 25])
plt.show()
Example 2: draw spiral in matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
n = 256
angle = np.linspace(0,12*2*np.pi, n)
radius = np.linspace(.5,1.,n)
x = radius * np.cos(angle)
y = radius * np.sin(angle)
plt.scatter(x,y,c = angle, cmap = cm.hsv)
plt.show()
// Matplotlib CB
Example 3: pyplot x vs y
plt.plot([1, 2, 3, 4], [1, 4, 9, 16])