Skip to content

multi-line axis titles unable to push margins #4299

Closed
@laura-cbre

Description

@laura-cbre

Automargin updates margin size correctly if axis title is large, due to say using a large font.
However, it does not update margin size if axis title is large due to line breaks.

fig.update_xaxes({'title_text': 'hiya', 'title_font': {'size': 100}, 'automargin': True})
image

fig.update_xaxes({'title_text': 'h<br>i<br>y<br>a', 'title_font': {'size': 100}, 'automargin': True})
image

Their data attributes:

(Scatter({
     'hoverinfo': 'x+name+text',
     'line': {'color': '#e53935'},
     'marker': {'color': '#e53935', 'line': {'color': '#e53935'}},
     'mode': 'lines',
     'name': 'a',
     'text': [1.000, 2.000, 3.000, 4.000],
     'x': array([datetime.datetime(2018, 1, 1, 0, 0),
                 datetime.datetime(2018, 1, 5, 0, 0),
                 datetime.datetime(2018, 1, 8, 0, 0),
                 datetime.datetime(2018, 1, 15, 0, 0)], dtype=object),
     'y': array([1, 2, 3, 4])
 }),)

First chart's layout attribute

Layout({
    'title': {'text': ''},
    'xaxis': {'automargin': True, 'title': {'font': {'size': 100}, 'text': 'hiya'}},
    'yaxis': {'rangemode': 'normal', 'title': {'text': 'degC'}}
})

Second chart's layout attribute

Layout({
    'title': {'text': ''},
    'xaxis': {'automargin': True, 'title': {'font': {'size': 100}, 'text': 'h<br>i<br>y<br>a'}},
    'yaxis': {'rangemode': 'normal', 'title': {'text': 'degC'}}
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions