我想用matplotlib来绘制3D热图与我的模拟结果。我读过this topic并尝试使用imshow。不幸的是,当我用SVG或EPS格式保存图形时,它将heatmat转换为图片(这对于期刊是不可接受的)。所以,我也试过hexbin - 但图像是如此奇怪。我不确定它会被期刊接受。我们还有别的东西吗,或者我必须用矩形填充heatmat?matplotlib与矢量格式的热图
例如,如果一个运行此代码:
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
# Generate some test data
x = np.random.randn(8873)
y = np.random.randn(8873)
heatmap, xedges, yedges = np.histogram2d(x, y, bins=50)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
print extent
print heatmap
plt.clf()
surf = plt.imshow(heatmap, extent=extent)
plt.colorbar(surf, shrink=0.75, aspect=5)
plt.show()
并保存SVG文件,它会containe PNG图像:
<g clip-path="url(#p6def4f5150)">
<image height="347" width="315" x="115.127800906" xlink:href="data:image/png;base64,
我使用matplotlib,1.1.1版本的OpenSUSE和Ubuntu下OS。
@tcaswell我编辑了主题 – rth