使用Python绘制热图的库 pyHeatMap 使用Python绘制热图的库 pyHeatMap
生活随笔
收集整理的這篇文章主要介紹了
使用Python绘制热图的库 pyHeatMap 使用Python绘制热图的库 pyHeatMap
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
pyHeatMap?詳細介紹
這是一個生成熱圖的小程序,基于 Python 和 PIL 開發。
程序截圖:
點擊圖
熱圖
安裝:
通過 pip 安裝:
pip install pyheatmap通過 easy_install 安裝:
easy_install pyheatmap通過源碼安裝:
git clone git://github.com/oldj/pyheatmap.git cd pyheatmap python setup.py install使用示例:
# -*- coding: utf-8 -*-import urllib from pyheatmap.heatmap import HeatMapdef main():# 下載測試數據url = "https://raw.github.com/oldj/pyheatmap/master/examples/test_data.txt"sdata = urllib.urlopen(url).read().split("\n")data = []for ln in sdata:a = ln.split(",")if len(a) != 2:continuea = [int(i) for i in a]data.append(a)# 開始繪制hm = HeatMap(data)hm.clickmap(save_as="hit.png")hm.heatmap(save_as="heat.png")if __name__ == "__main__":main()總結
以上是生活随笔為你收集整理的使用Python绘制热图的库 pyHeatMap 使用Python绘制热图的库 pyHeatMap的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2018读书清单与情况
- 下一篇: Mediawiki安装经验分享