Plotly 是一个优秀的库,带有 Python 绑定,允许创建交互式绘图。它的工作方式是将 Python 代码转换为 JavaScript,允许在浏览器中进行交互式可视化。例子:import plotly.plotly as pyimport plotly.graph_objs as go# Create random data with numpyimport numpy as npN = 1000random_x = np.random.randn(N)random_y = np.random.randn(N)# Create a tracetrace = 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 pyimport plotly.graph_objs as go# Create random data with numpyimport numpy as npN = 1000random_x = np.random.randn(N)random_y = np.random.randn(N)# Create a tracetrace = 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 站点上存储私人地块。如果您不需要此功能,您可以愉快地使用免费版本。