【发布时间】:2012-02-04 11:08:39
【问题描述】:
我正在编写一个脚本来为二维S上的散点数据制作热图。以下是我正在尝试做的一个玩具示例:
import numpy as np
from matplotlib.pyplot import*
x = [1,2,3,4,5]
y = [1,2,3,4,5]
heatmap, xedges, yedges = np.histogram2d(x, y, bins=50)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
imshow(heatmap, extent = extent)
我应该期望“最温暖”的区域沿着 y=x 显示,但它们却沿着 y=-x+5 显示,即热图以相反的方向读取一个列表。我不确定为什么会这样。有什么建议吗?
谢谢
【问题讨论】:
标签: matplotlib heatmap scatter-plot