Hello everybody!
First of all thank you, because you are a great help in using plotly.
Normally, if the generated plot is bigger than the container, plotly doesn’t show everything, you have to enlarge certain areas to see all the bars (for example).
Is there any way to control this better? The plot looks fine even though bars are missing, and you can perfectly well lose information if you don’t think of enlarging it.
The same happens when generating the image, information can be lost.
Example:
On a container you have this:
It looks fine. You can think all data is there
Now, if you enlarge it you see that’s not true:
How can I fix this, can I force it to show everything, or is there a way to predict the necessary size? Or something else?
I add an MRE:
fig = go.Figure()
fig.add_trace(go.Bar(
x = [2, 3, 5, 6, 5, 4, 4, 1 , 1, 5, 3, 4, 3, 5],
y = [['First', 'First','First', 'First','First', 'First','First', 'First', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second'],
["A", "B", "C", "D","E", "F","G","H", "A", "B", "C", "D","E", "F"]],
name = "Adults",
orientation='h'
))
fig.add_trace(go.Bar(
x = [2, 3, 5, 6, 5, 4, 4, 1 , 1, 5, 3, 4, 3, 5],
y = [['First', 'First','First', 'First','First', 'First','First', 'First', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second', 'Second'],
["G", "H", "I", "J","K", "L","M","N", "G", "H", "J", "K","L", "M"]],
name = "Children",
orientation='h'
))
fig.update_layout(barmode='stack')
new_element = html.Div(
style={'width': :'700px', 'height':'400px','display': 'inline-block', 'outline': 'thin lightgrey solid', 'padding': 10},
children=[
dcc.Graph(
id='example'
style={'height': 400},
figure=fig
)
]
)
Thank you.