Skip to content

axis automargin moves axis label outside of individual tick labels, not the longest tick label #2575

Description

@yniknafs

see #2243

Using automargin: true moves axis label outside of tick labels, but only to the tick labels near the axis label, not below the longest tick label.

e.g.,

image

Activity

  1. alexcjohnson commented on Apr 20, 2018

    @alexcjohnson
    Collaborator

    Thanks @yniknafs - can you work this plot into a codepen/jsfiddle so we can debug?

  2. yniknafs commented on Apr 20, 2018

    @yniknafs
    Author

    Made a codepen showing the behavior.

    image

  3. yniknafs commented on Apr 20, 2018

    @yniknafs
    Author

    Honestly, I think this behavior could work if it wasn't so close to the tick labels. A short term fix may be to just add a bigger buffer? the way it is now, the label can sort of get lose in the tick labels. A few extra pixels could go a long way.

  4. alexcjohnson commented on Apr 20, 2018

    @alexcjohnson
    Collaborator

    Thanks @yniknafs for the codepen 🎉

    @nicolaskruchten I thought in my fiddling yesterday it looked like in cases like this we were pushing the x title down below all the tick labels... but here we are automatically adjusting the margins but the title just avoids the nearby labels... even if I shorten the really long labels.

    So let me toss this back to you, is this a bug or is this how the feature was intended to work so this is a feature request?

    @yniknafs totally agreed that the title/label padding would be nice as an adjustable parameter.

  5. nicolaskruchten commented on Apr 20, 2018

    @nicolaskruchten
    Contributor

    Let me dig into this today, this behaviour does seem at odds with the intended behaviour.

  6. nicolaskruchten commented on Apr 23, 2018

    @nicolaskruchten
    Contributor

    So the current behaviour surprised me, but is actually not a bug: the automargin feature correctly pushes the margins so as to leaves enough room below the tick labels for the axis title's font height, but the axis title doesn't always position itself below the tallest tick label: it positions itself below the tallest tick label above itself which my tests hadn't shown, hence my initial surprise.

    So this is not a bug but a reasonable feature request: to be able to control the positioning of the axis title with respect to the labels above it :)

  7. removed their assignment
    on Apr 23, 2018
  8. yniknafs commented on Apr 27, 2018

    @yniknafs
    Author

    @nicolaskruchten Thanks for the response. I agree - the auto margin is technically doing what it should do. In practice, I think the current functionality could result in a plots that don't look quite right. See image below. I'm kind of stuck between a rock and a hard place with this. Not sure what I can do to make it look right. May have to add my own custom annotation, which isn't pleasant for a dynamic plot that can have different labels / different numbers of bars, etc.

    image

  9. gvwilson commented on Jun 11, 2024

    @gvwilson
    Contributor

    Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions