I am trying to plot a 2d histogram showing the correlation between the error codes received between two measurements. The error code values range from -3 to 5. I would like the histogram to show a bar for every error code. The bars should increase (change color) in the field marked by the two error codes received for one measurement. I have drawn a short sketch here.
So far I only have the code below, which unfortunately does not give me the desired plot. Does anybody know how to get a plot as I described above?
data1=np.random.randint(-3,5,100)
data2=np.random.randint(-3,5,100)
fig, ax = plt.subplots()
ax.hist2d(data1, data2, bins=10)
plt.Axes.set_xlim(ax,left=-3, right=6)
plt.Axes.set_ylim(ax, bottom=-3, top=6)
plt.grid(True)
plt.show()