Plotly - 如何制作没有盒子的箱线图?

sou*_*alo 5 python plotly plotly-python

我试图在 python 中使用plotly来创建箱线图,但我只想要点,而不是盒子、晶须或其他任何东西。像这样的东西: 在此输入图像描述

找不到办法做到这一点。我能做的最好的就是 set ,但这只显示框 之外的boxpoints='all'点:在此输入图像描述

这可能吗?有解决方法的想法吗?

ves*_*and 6

pointpos = 0要删除的所需元素的设置和颜色rgba(0,0,0,0)

阴谋:

在此输入图像描述

Jupyter 笔记本的代码:

# imports
import plotly
from plotly import tools
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import pandas as pd
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go

# setup
init_notebook_mode(connected=True)
np.random.seed(123)

# data
y0 = np.random.randn(50)-1
y1 = np.random.randn(50)+1

# traces
trace0 = go.Box(
    y=y0, boxpoints = 'all', pointpos = 0,
    marker = dict(color = 'rgb(66, 167, 244)'),
    line = dict(color = 'rgba(0,0,0,0)'),
    fillcolor = 'rgba(0,0,0,0)'
)

trace1 = go.Box(
    y=y1, boxpoints = 'all', pointpos = 0,
    marker = dict(color = 'rgb(84, 173, 39)'),
    line = dict(color = 'rgba(0,0,0,0)'),
    fillcolor = 'rgba(0,0,0,0)'
)

# figure
data = [trace0, trace1]
layout = go.Layout(width=750, height=500)
fig = go.Figure(data, layout)

# plot
iplot(fig)
Run Code Online (Sandbox Code Playgroud)