【问题标题】:Is there a specific chart that can be used to plot this type of data?是否有可用于绘制此类数据的特定图表?
【发布时间】:2021-04-13 20:13:39
【问题描述】:

我有这个数据

Zip Codes  Year     Mean
2443       2016    92.869565
           2017    93.364486
           2018    93.070000
           2019    93.760000
2445       2016    94.848837
                     ...    
27326      2019    99.000000
27334      2016    94.250000
           2017    95.625000
           2018    96.812500
           2019    97.666667

我有上述来自 pandas 的数据框,其中每个邮政编码有 4 个不同年份的大约 1000 个邮政编码,以及特定植物高度的平均值。

表示这些数据的最佳方式是什么?

【问题讨论】:

  • 用当年的平均数据填入地图,然后创建四年的四张图怎么样?我建议在this example画四年。

标签: python pandas matplotlib seaborn


【解决方案1】:

使用热图 (seaborn.heatmap),其中行为邮政编码,列为年份,单元格颜色为平均植物高度。

另请参阅:
Plotting a 2D heatmap with Matplotlib
Making heatmap from pandas DataFrame
The Python Graph Gallery: Heatmap

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-15
    • 1970-01-01
    • 2022-06-15
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多