基于D3的Python绘图库:D3py

jopen 10年前

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() 

散点图

线图

条形图

区域图



项目主页:http://www.open-open.com/lib/view/home/1404377308264