Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

How to prevent text label overlapping?

Hi there -

I am working with a bar chart which is showing y-axis label and number label. However, the number is overlapping with the y-axis label. Any ideas to solve this issue?

some info about my chart:

  • have to set it as col-md-3 due to limited space for multiple charts/tables on the same page.

  • part of my code:
    return {
    ‘data’: [go.Bar(
    x=df[‘Risk Contribution’],
    y=df[‘Risk Group’],
    text=df[‘Risk Contribution’],
    textposition=‘auto’,
    orientation=‘h’,
    cliponaxis=False,
    marker=go.Marker(color=factor_color_muni(df[‘Risk Group’])))],

      'layout': go.Layout(title='Factor Contribution',
                          yaxis=go.YAxis(
                              showticklabels=True,
                              showgrid=False,
                              showaxeslabels=True,
                              tickangle=0, ),
                          margin=go.Margin(l=130, r=5, t=50, b=40)
                          )
    

image

Thank you,
Erica