Python 什么是pd.plot.hexbin的方形网格等效物?

Python 什么是pd.plot.hexbin的方形网格等效物?,python,pandas,histogram,Python,Pandas,Histogram,我有一个数据框中的数据。使用代码: sd.plot.hexbin(x="fact", y="value", gridsize=25) 我可以得到以下的图: 我喜欢这一点的优雅——是否有一个等效的熊猫功能,用方形垃圾箱创建相同的地块?我意识到使用numpy2dhistogram有一些解决方案,但这需要一个显式的x和y变量。例如:将让我做: sd_cln=sd[~sd.value.isnull()] hist,xedges,yedges = np.hist

我有一个数据框中的数据。使用代码:

sd.plot.hexbin(x="fact", y="value", gridsize=25)
我可以得到以下的图:

我喜欢这一点的优雅——是否有一个等效的熊猫功能,用方形垃圾箱创建相同的地块?我意识到使用numpy2dhistogram有一些解决方案,但这需要一个显式的x和y变量。例如:将让我做:

sd_cln=sd[~sd.value.isnull()]
hist,xedges,yedges = np.histogram2d(sd_cln.fact,sd_cln.value,bins=40)#,range=[[0,25],[0,100]])
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1] ]
plt.imshow(hist.T,extent=extent,interpolation='nearest',origin='lower')
plt.colorbar()
plt.show()
制作:

令人费解的是,如果我将范围硬编码为1200,我会得到相同的图,但如果我将y max设得很低,那么图开始看起来很合适:

#create above plot but with grid
...
hist,xedges,yedges = np.histogram2d(sd_cln.fact,sd_cln.value,bins=40,range=[[0,25],[0,100]])
...

有没有办法用这些数据创建等效于hexbin的等效平方网格图