基于D3的Python繪圖庫:D3py

jopen 10年前發布 | 46K 次閱讀 D3py 圖表/報表制作

D3py是一個基于D3的Python繪圖庫。d3py的目的是提供一個簡單的方法將來自命令行或簡單的腳本數據畫到瀏覽器窗口。

import d3py
import pandas
import numpy as np

some test data

T = 100

this is a data frame with three columns (we only use 2)

df = pandas.DataFrame({ "time" : range(T), "pressure": np.random.rand(T), "temp" : np.random.rand(T) })

build up a figure, ggplot2 style

instantiate the figure object

fig = d3py.PandasFigure(df, name="basic_example", width=300, height=300)

add some red points

fig += d3py.geoms.Point(x="pressure", y="temp", fill="red")

writes 3 files, starts up a server, then draws some beautiful points in Chrome

fig.show() </pre>

散點圖

線圖

條形圖

區域圖



項目主頁:http://www.baiduhome.net/lib/view/home/1404377308264

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!