dimanche 17 juillet 2022

keep returning value error even though I change the s value

import matplotlib.pyplot as plt
import numpy as np
import random

x = np.random.randint(-100,100,1000)
y = np.random.randint(-100,100,1000)
size = np.random.rand(100) * 100

mask1 = abs(x) > 50
mask2 = abs(y) > 50

x = x[mask1+mask2]
y = y[mask1+mask2]


plt.scatter(x, y, s=size, c=x, cmap='jet', alpha=0.7)
plt.colorbar()
plt.show()

I can't find what's wrong with this code. It just returns a ValueError. I am assuming something is wrong with the 'size = ' part. I tried changing size = np.random.rand(100) to (1000) but still didn't work.




Aucun commentaire:

Enregistrer un commentaire