我有两个布尔变量,我尝试用组创建一个箱线图。每个组应该代表一个变量,并且应该包含两个箱线图,一个代表 TRUE,一个代表 FALSE。相反,我得到两组,一组代表 TRUE,一组代表 FALSE,每组有两个箱线图对应于每个变量,如附图所示:
我知道组是从 xaxis 派生的。但是我怎样才能让变量名是组?我用于输出的代码:
trace3= Box(
y=raw_matrix.TPS,
x=raw_matrix.noClassGc,
name='noClassGc',
marker=Marker(
color='#3F5D7D'
))
trace4= Box(
y=raw_matrix.TPS,
x=raw_matrix.aggresiveOpts,
name='aggresiveOpts',
marker=Marker(
color='#0099FF'
))
data = Data([trace3, trace4])
layout = Layout(
yaxis=YAxis(
title='confidence',
zeroline=False),
boxmode='group',
boxgroupgap=0.5
)
fig = Figure(data=data, layout=layout)
plot_url = ploteczki.plot(fig, filename='Performance by categoricals parameters')