Answers for "draw function matplotlib"

20

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()
Posted by: Guest on February-10-2020
1

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
Posted by: Guest on June-15-2020
0

pyplot x vs y

plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
Posted by: Guest on November-07-2020

Python Answers by Framework

Browse Popular Code Answers by Language