Skip to content

Automargin clipping ticklabels #2985

Closed

Description

@sglyon

I'm trying to use *axis.automargin to get the minimum necessary margin to display all tick labels/axis titles.

To do that I set layout.margin.[tblr] to 0 and then set layout.[xy]axis.automargin to true.

When I do this and do not have axis titles, the tick labels are slightly clipped. See this pen for an example: https://codepen.io/anon/pen/XPzEeN

When in the pen if you uncomment the line that sets layout.yaxis.title = "", you'll notice that the ticks are no longer clipped.

Activity

  1. sglyon commented on Sep 7, 2018

    @sglyon
    Author

    Update, if you do have a yaxis title that is long enough to run into ticks, it will cover them up.

    I've updated the pen with another section that has

      // Uncomment the line below and the yaxis.title will cover up some ticks
      // layout.yaxis.title = "This is y and it runs into ticks"

    and if you uncomment the long title you can see what I mean.

    It is very possible that I'm simply trying to use this in the wrong way. If there is a better/easier way to reach my goal (minimum margin where nothing is clipped), I'd love to hear it

  2. etpinard commented on Dec 12, 2018

    @etpinard
    Contributor

    Related: #2434

  3. zbjornson commented on Jan 21, 2019

    @zbjornson

    Here's a particularly egregious example of I think the same issue: https://codepen.io/anon/pen/XOWWNa

  4. cldougl commented on Jan 30, 2019

    @cldougl
    Member

    One of the goals of ddk is to provide reduced margins by default so we're running into this issue in most of our examples as the margin size is templated as in the example below:
    https://codepen.io/plotly/pen/bzBOjL?editors=1010

  5. etpinard commented on Jan 31, 2019

    @etpinard
    Contributor

    Would setting a margin of 1px (together with ax.automargin:true) like in https://codepen.io/etpinard/pen/omBbBv be ok for now?

  6. wbrgss commented on Jan 31, 2019

    @wbrgss
    Contributor

    @etpinard Thanks for taking a look. I don't think this will work for us though; it seems any margin smaller than the tick size will mean clipped ticks — see the x-axis ticks on
    https://codepen.io/anon/pen/GzrjxN

    I've tried the layout.yaxis.title = "" trick, which appears to work well for most graphs, but that's not going to work for us with components that make use of plots flush with their container, such as the following (sorry for the lack of codepen)
    datacard

    If layout.yaxis.title = "" hack really is the best solution for now I think I'll do my best to work around the above issue with the flush-with-border plots.

  7. etpinard commented on Jan 31, 2019

    @etpinard
    Contributor

    Ah there is it:

    image

    My bad. I'll see If I can get a quick fix in for this thing. Thanks for reporting!

  8. self-assigned this
    on Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions