1 回答
TA贡献1850条经验 获得超11个赞
Plotly 是一个优秀的库,带有 Python 绑定,允许创建交互式绘图。它的工作方式是将 Python 代码转换为 JavaScript,允许在浏览器中进行交互式可视化。
例子:
import plotly.plotly as py
import plotly.graph_objs as go
# Create random data with numpy
import numpy as np
N = 1000
random_x = np.random.randn(N)
random_y = np.random.randn(N)
# Create a trace
trace = go.Scatter(
x = random_x,
y = random_y,
mode = 'markers'
)
data = [trace]
# Plot and embed in ipython notebook!
py.iplot(data, filename='basic-scatter')
# or plot with: plot_url = py.plot(data, filename='basic-line') import plotly.plotly as py
import plotly.graph_objs as go
# Create random data with numpy
import numpy as np
N = 1000
random_x = np.random.randn(N)
random_y = np.random.randn(N)
# Create a trace
trace = go.Scatter(
x = random_x,
y = random_y,
mode = 'markers'
)
data = [trace]
# Plot and embed in ipython notebook!
py.iplot(data, filename='basic-scatter')
# or plot with: plot_url = py.plot(data, filename='basic-line')
Plotly 有一个付费订阅,允许在 Plotly 站点上存储私人地块。如果您不需要此功能,您可以愉快地使用免费版本。
添加回答
举报