plot Plot with missing values

 

 

x = np.linspace(1,10,25)

y = (x-4)**2 
index = random.sample(range(25),5) #Randomly draw 5 numbers from 1-24 without replacement 
y[index ] = [np.nan]*5


plt.plot(x,y, ' o- ' ) #Make sure that x,y are of equal length 
plt.show() 

plt.plot(x,(x-4)**2,'x',x,y, 'o-')
plt.show()

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325067180&siteId=291194637