np.random.seed(1)
data = [np.random.randn(100) for _ in range(19)] # 19 subplots
color = n_colors('rgb(5, 200, 200)', 'rgb(200, 10, 10)', 19, colortype='rgb')
fig = make_subplots(rows=10, cols=2)
for i in range(10):
for j in range(2):
index = i * 2 + j
row = i + 1
col = j + 1
if index < len(data):
fig.add_trace(
go.Violin(x=data[index], line_color='black', hoverinfo='none', fillcolor=color[index],
line_width=1.5, name=self.X_VARS[index]),
row=row, col=col)
min_value = np.min(data[index])
max_value = np.max(data[index])
fig.add_shape(type="line",
x0=min_value, y0=0, x1=min_value, y1=1,
line=dict(color="black", width=2),
row=row, col=col)
fig.add_shape(type="line",
x0=max_value, y0=0, x1=max_value, y1=1,
line=dict(color="darkgoldenrod", width=2),
row=row, col=col)
fig.update_traces(orientation='h', side='positive', width=3, points=False)
fig.update_layout(xaxis_showgrid=False, xaxis_zeroline=False, showlegend=False, plot_bgcolor='#ffffff', )
fig.update_xaxes(showgrid=False, zeroline=False, showticklabels=False)
fig.update_yaxes(showgrid=False, zeroline=False, ticklabelposition="inside left")
chart = fig.to_html()
If I understand correctly, there is no easy way to do that. Iβve seen people doing some hacks by adding a βrightβ extra y-axis, but couldnβt figure it out for the subplots case. Can anyone help?