python绘图plotly包

1.安装

pip install plotly==4.4.1

2.使用
【python绘图plotly包】示例1:
import plotly.graph_objects as go fig = go.Figure() fig.add_trace(go.Scatter(y=[2, 1, 4, 3])) fig.add_trace(go.Bar(y=[1, 4, 3, 2])) fig.update_layout(title = 'Hello Figure') fig.show()

示例2:
import numpy as npx = np.random.randn(500) y = np.random.randn(500)+1fig = go.Figure(go.Histogram2d(x=x, y=y, histnorm='probability', autobinx=False, xbins=dict(start=-3, end=3, size=0.1), autobiny=False, ybins=dict(start=-2.5, end=4, size=0.1), colorscale=[[0, 'rgb(12,51,131)'], [0.25, 'rgb(10,136,186)'], [0.5, 'rgb(242,211,56)'], [0.75, 'rgb(242,143,56)'], [1, 'rgb(217,30,30)']] )) fig.show()

支持放大缩小操作:
python绘图plotly包
文章图片

参考:
  1. 官方GitHub plotly包;
  2. 官方plotly示例;

    推荐阅读