matplotlib.pyplot hist2d使用锤子投影

时间:2014-07-25 09:04:39

标签: matplotlib histogram projection

是否可以在matplotlib.pyplot中使用带有hist2d的'hammer'(或任何其他)投影?

我知道使用例如散点图很容易这段代码(我使用之前使用register_projection('custom_hammer')注册的自定义锤子版本):

plt.subplot(111, projection='custom_hammer')
plt.scatter(GalLon, GalLat, color='red')

这里,GalLon和GalLat是numpy数组(1D)。这创建了一个很好的散点图。现在我想对数据进行直方图,但保留预测:

plt.subplot(111, projection='custom_hammer')
plt.hist2d(GalLon, GalLat, bins=[36, 18], norm=LogNorm())

这是创建一个空的天空图并出现以下错误:

/usr/lib/pymodules/python2.7/matplotlib/image.py:156: RuntimeWarning: divide by zero encountered in double_scalars
  sx = dxintv/viewlim.width
/usr/lib/pymodules/python2.7/matplotlib/image.py:172: RuntimeWarning: divide by zero encountered in double_scalars
  sx = dxintv/viewlim.width

0 个答案:

没有答案