I'm pretty new to this. I have some data for a population of several million people, which include e.g., age, height, waist size, head circumference, etc ... I'm trying to make a plot of the full sample (e.g., age vs height of people) shaded by number density, and at the same time colour coded by another parameter (e.g., waist size).
E.g., for the age vs heigh shaded by density (e.g., using 200x200 bins) I am doing
plt.hist2d(age,height,(200,200),norm=LogNorm())
and this works fine.
To colour code the same figure by waist size I am doing
H, xedges, yedges = np.histogram2d(age,height,bins=300,weights=waist)
count, x, y = np.histogram2d(age,income,bins=300)
H/=count
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
plt.imshow(H.T, extent=extent, interpolation='nearest', aspect='auto',origin='lower',cmap='jet')
which also works fine.
What I would like to do, is have a density plot which is also colour-coded e.g., by waist I.e. the colour palette depends on waist size, but the intensity (shading?) of the colour depends on the number density in each bin. I believe this is possible, but I have no idea how to do it. Any suggestion would be welcome! Thanks!