So on the right I've got eigenvalue spectra of 1000 matrices scatter plotted over each other. On the left I wanted get a histogram oder density function to where eigenvalues occur and how often.
The histogram is done with numpy:
bins = 200
d = max(max(re), max(im), -min(re), -min(im))
histogram2D, binsX, binsY = np.histogram2d(re, im, bins=bins, range=((-d,d),(-d,d)))
histogram2D = histogram2D.T
Additionally to the amount of eigenvalues in each bin I wanted the histogram still to show clearly where eigenvalues occured and where they did not. So I made my own colormap:
def redblue_zeta(Zmin, Zmax, zeta=0.0):
breakingpoint = float(Zmin)+float(zeta)/(float(Zmax)-float(Zmin))
cdict = {'red': ((0.0, 1.0, 1.0), (breakingpoint, 1.0, 0.0), (1.0, 1.0, 1.0)),
'green': ((0.0, 1.0, 1.0), (breakingpoint, 1.0, 0.0), (1.0, 0.0, 0.0)),
'blue': ((0.0, 1.0, 1.0), (breakingpoint, 1.0, 1.0), (1.0, 0.0, 0.0))}
return(cdict)
(This is a bit more complicated because I use the map for other plots where zeta>0 aswell.) And then I plotted:
Zmax = histogram2D.max()
cdict=cc.redblue_zeta(0,Zmax,zeta=0.0)
plt.register_cmap(name='rb', data=cdict)
plt.imshow(histogram2D, cmap=cm.get_cmap('rb'), extent=[-d, d, -d, d], interpolation='nearest')
So a point in the 2D plot is supposed to white if there are exactly zero eigenvalues in that bin. Otherwise it is supposed to be anything between blue and red. But that's not what I get. It seems that either the histogram or the colormap rounds small values to zero because I get a way too small blue region in the histogram plot. Any ideas? Thanks.