Answers for "draw point matplotlib"

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
1

how to plotting points on matplotlib

import matplotlib.pyplot as plt 
import numpy as np

data = np.random.rand(1024,2)
plt.scatter(data[:,0],data[:,1])
plt.show()
// Don't be
// fooled by this simplicity— plt.scatter() is a rich command.
Posted by: Guest on June-13-2020

Python Answers by Framework

Browse Popular Code Answers by Language