Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
I am facing a problem in matplotlib, using hexbin with weights (argument C=).
When I am filling the C argument, not only the ouput color changes but also the shape. Here is a very simple code snippet reproducing the behavior:
npts = int(2e5) # Create a random distribution and another one as it perturbation x1 = np.random.randint(0,3000,npts) x2 = x1 + np.random.normal(loc=0,scale=75,size=npts) # Same for the second axis variable y1 = np.random.randint(280,310,npts) y2 = y1 + np.random.normal(loc=0,scale=2,size=npts) # Plot fig, axes = plt.subplots(2,1) ax = axes[0] ax.hexbin(y2-y1,x1,mincnt=1,extent=[-8,8,0,3000], gridsize=150) # ax = axes[1] res = ax.hexbin(y2-y1,x1,C=x1,mincnt=1,extent=[-8,8,0,3000], gridsize=150) fig.savefig(f"hexbin_weights.png") plt.show()
To my understanding, as the x and y coordinates of the points are identical, only the color on the two plots should change. However, it is clearly not the case. Is it another parameter that is changing without me being aware of ? Is C not doing what I expect it to do ?
Thanks in advance for any help !