- Plotly教程
- 阴谋 - 主页
- Plotly - 简介
- Plotly - 环境设置
- Plotly - 在线和离线绘图
- 使用 Jupyter Notebook 内联绘图
- Plotly - 包结构
- Plotly - 导出到静态图像
- Plotly - 传奇
- Plotly - 设置轴和刻度的格式
- Plotly - 子图和插图
- Plotly - 条形图和饼图
- Plotly - 散点图、Scattergl 图和气泡图
- Plotly - 点图和表格
- Plotly - 直方图
- Plotly - 箱线图小提琴图和等高线图
- Plotly - 分布图、密度图和误差条图
- Plotly - 热图
- Plotly - 极坐标图和雷达图
- Plotly - OHLC 图表瀑布图和漏斗图
- Plotly - 3D 散点图和曲面图
- Plotly - 添加按钮/下拉菜单
- Plotly - 滑块控制
- Plotly -FigureWidget 类
- 与pandas和袖扣密谋
- 使用 Matplotlib 和 Chart Studio 绘图
- 非常有用的资源
- Plotly - 快速指南
- Plotly - 有用的资源
- Plotly - 讨论
Plotly - 热图
热图(或热图)是数据的图形表示形式,其中矩阵中包含的各个值以颜色表示。热图的主要目的是更好地可视化数据集中的位置/事件量,并帮助引导查看者看到最重要的数据可视化区域。
由于依赖颜色来传达值,热图可能最常用于显示更通用的数值视图。热图在吸引人们对趋势的关注方面非常通用且高效,正是由于这些原因,它们在分析社区中变得越来越受欢迎。
热图本质上是不言自明的。色调越深,数量越大(值越高,分散越紧密等)。Plotly 的 graph_objects 模块包含Heatmap()函数。它需要 x、y和z属性。它们的值可以是列表、numpy 数组或 Pandas 数据框。
在下面的示例中,我们有一个二维列表或数组,用于将数据(不同农民的收获量,以吨/年为单位)定义为颜色代码。然后我们还需要两份农民名单和他们种植的蔬菜名单。
vegetables = [
"cucumber",
"tomato",
"lettuce",
"asparagus",
"potato",
"wheat",
"barley"
]
farmers = [
"Farmer Joe",
"Upland Bros.",
"Smith Gardening",
"Agrifun",
"Organiculture",
"BioGoods Ltd.",
"Cornylee Corp."
]
harvest = np.array(
[
[0.8, 2.4, 2.5, 3.9, 0.0, 4.0, 0.0],
[2.4, 0.0, 4.0, 1.0, 2.7, 0.0, 0.0],
[1.1, 2.4, 0.8, 4.3, 1.9, 4.4, 0.0],
[0.6, 0.0, 0.3, 0.0, 3.1, 0.0, 0.0],
[0.7, 1.7, 0.6, 2.6, 2.2, 6.2, 0.0],
[1.3, 1.2, 0.0, 0.0, 0.0, 3.2, 5.1],
[0.1, 2.0, 0.0, 1.4, 0.0, 1.9, 6.3]
]
)
trace = go.Heatmap(
x = vegetables,
y = farmers,
z = harvest,
type = 'heatmap',
colorscale = 'Viridis'
)
data = [trace]
fig = go.Figure(data = data)
iplot(fig)
上述代码的输出如下 -
