0
Ich habe versucht, Daten von Arrays in ein 2D-Histogramm einzugeben und plt.imshow zu verwenden, um es anzuzeigen. Allerdings war ich bisher nicht erfolgreich. Ich bekomme ein leeres Array mit den richtigen Labels, aber es gibt keine Punkte zu entdecken. Ich habe online Beispiele gesucht, ohne Erfolg.Keine Punkte im 2d-Histogramm
d[0]= array([ 559.31299349, 507.44063212, 596.05952403, ..., 531.48861237,
525.03097371, 512.51860453])
d[1]= array([ 604.44753343, 513.26418859, 658.79946406, ..., 543.09749822,
522.69953756, 579.40805154])
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
d = np.load('XandY.npy')
x = d[0]
y = d[1]
gridx = np.linspace(min(x),max(x),10)
gridy = np.linspace(min(y),max(y),10)
H, xedges, yedges = np.histogram2d(x, y, bins=[gridx, gridy])
fig1 = plt.figure()
plt.plot=(x,y,'ro')
plt.grid(True)
plt.xlabel('array X')
plt.ylabel('array y')
plt.figure()
myextent =[xedges[0],xedges[-1],yedges[0],yedges[-1]]
plt.imshow(H.T,origin='low',extent=myextent,aspect='auto')
plt.plot(x,y,'ro')
plt.colorbar()
plt.show()
Wo sind meine Punkte hin?