Hello everybody,
This is my first post on the plotly forum!
I decided to contact you because I am working on a graph with 16 groups of 2 boxplots. Unfortunately, my boxplots appear completely narrowed in width, as you can see
I tried to use update_layout to set the boxgap and boxgroupgap, but this has not changed anything.
Here is my code below:
colors = ['#d52221', '#f44f39', '#fc8161', '#fcaf93',
'#fedbcc', '#feb23f', '#f4811d', '#2b7bba',
'#539ecd', '#89bedc', '#bad6eb', '#2c944c',
'#8ed08b', '#d1d2e7', '#705eaa', '#adadad']
fig = go.Figure()
# Nora's data
for i, col in enumerate(pi_percent):
fig.add_trace(go.Box(y=pi_percent[col],
name = col,
marker=dict(color=colors[i])))
# Mara's data
for i, col in enumerate(pi_percent_mara):
fig.add_trace(go.Box(y=pi_percent_mara[col],
name = col,
marker=dict(color=colors[i])))
fig.update_layout(
boxmode='group',
boxgap=0,
boxgroupgap=0,
autosize=False,
width=1500,
height=600,
margin=dict(
l=50,
r=50,
b=100,
t=100,
pad=4),
title={'text':"Nucleotide diversity",
'y':0.9,
'x':0.5,
'xanchor': 'center',
'yanchor': 'top'},
xaxis_title="Population",
yaxis_title="Pi (%)",
font=dict(
family="Arial, monospace",
size=12,
color="black"),
showlegend=False,
template="plotly_white") #"plotly", "plotly_white", "plotly_dark", "ggplot2", "seaborn", "simple_white", "none"
# A data every 0.5% for y axis
fig.update_yaxes(tick0=0, dtick=0.5)
fig.update_xaxes(tickangle=-45,
ticklabelposition='outside bottom') #['outside', 'inside', 'outside top', 'inside top', 'outside left', 'inside left', 'outside right', 'inside right', 'outside bottom', 'inside bottom']
fig.show()
I just want to expand my boxplots.
I thank you in advance for the help you will give me.
Regards