- 箱线图
- 饼图
3.箱线图
import plotly.offline as of
import plotly.graph_objs as go
x0 = np.random.randn(50)
x1 = np.random.randn(50)
colors = ['#faee1c', '#f3558e']
trace0 = go.Box(
x = x0,
name = 'box1',
marker = {'color': colors[0]}
)
trace1 = go.Box(
x = x1,
name = 'box2',
boxpoints = 'all', # 显示出每一个点
jitter = 0.3, # 点在y轴上的随机抖动距离
pointpos = -1.8, # 点在y轴上的偏移距离
marker = dict(
color = colors[3],
line = dict(
color = 'red',
widh = 1
)
)
)
data = [trace0, trace1]
layout = go.Layout(
title = '箱线图测试'
)
fig = go.Figure(data=data, layout=layout)
of.init_notebook_mode()
of.iplot(fig)
4.饼图
<