How to modify the size with graph_objects

Hello

I am triying to modify the size of my figure. I want to do that beacuse I can not see some labels in a graph.

.

import plotly.graph_objects as go

fig = go.Figure(go.Bar(
            x=dfEstrato.Estrato,
            y=dfEstrato.Part,
            text=dfEstrato.Part,
            texttemplate = "%{y}%",              
            textposition = "outside",
            orientation='v'))

fig.update_traces(marker_color='#000080')
fig.update_layout(title_text='3. Estrato Socioeconomico',yaxis = go.YAxis(showticklabels=False))

fig.show()

This is the datafreme dfEstrato.

image

Thanks

Try increasing the top (β€˜t’) margin in the figure layout. That might fix it.

e.g.

layout = {β€˜margin’:{β€˜t’:100}}

this isn’t documented well, but try setting the cliponaxis property to false: fig.update_yaxis(cliponaxis=False)

ideally this would be the default, but since we added it after adding text, setting it as the default would be backwards incompatible. so, i’d recommend always setting this.

Hello, I try your recomendation but I continue with the same problem

I did the follow:

fig.update_layout(title_text='3. Estrato Socioeconomico',yaxis = go.YAxis(showticklabels=False,cliponaxis=False))

I did the follow But I continue with the same problem.

fig.update_layout(title_text='3. Estrato Socioeconomico',yaxis = go.YAxis(showticklabels=False,cliponaxis=False),layout = {"margin":{"t":100}})

I have got old code where I have cliponaxis in the trace itself (as opposed to yaxis). Can you try:

trace={
...

 'cliponaxis':False,

...

}
2 Likes