✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Why are my x axis labels so far away from chart?

Why are my x axis labels so far away from chart?

This is px.scatter chart

plotly chart xaxis too big

has margins like this:

        "margin": dict(
            l=10, 
            r=10, 
            t=50, 
            b=10
        ),

the x and y axis are formatted as:

fig.update_xaxes(
    dict(
        title_text="", 
        showline=False,
        linecolor=color_lines, 
        showgrid=False,
    ),
    tickfont=dict(
        size=12
    ),
)

fig.update_yaxes(
    dict(
        title_text="",
        showline=False,
        linecolor=color_lines,
        showgrid=True, 
        gridwidth=1, 
        gridcolor=color_lines,
        dtick=1,
        categoryorder='category descending',
    ),
    tickfont=dict(
        size=8
    ),
)