Skip to content

Create a "stick-inside" mode for ticks labels #3292

Closed

Description

@EBoisseauSierra

Context

Say we have a first quadrant chart:

ticks1

One can notice that ticks' labels are horizontally/vertically centred (compared to the ticks themselves) on the horizontal/vertical axis, respectively.

This makes that first and last ticks value "stick out" from the graph; what can be a bit ungainly — especially if one shows one axis only:

ticks3

This is also inconvenient when you want to precisely align you axes with elements surrounding your picture (e.g., in the example above, if you want the 0% tick mark to be the most-left point of the picture).

Question

➥ Could it be possible to have a "stick inside" mode for ticks values?

The idea is to change the vertical/horizontal alignment of the first and last ticks values:

  • left and right aligned, respectively, for the horizontal axis:
    ticks3

  • bottom and top aligned, respectively, for the vertical axis:
    ticks4

Our first example would then look like this:
ticks5

Variant

An even more super-duper mode would enable us to choose which end on the axis to "stick inside", so that one could make such graph:
ticks6

Activity

  1. etpinard commented on Nov 26, 2018

    @etpinard
    Contributor

    Thanks for writing in.

    This request seems very related to #1673

  2. EBoisseauSierra commented on Nov 27, 2018

    @EBoisseauSierra
    Author

    @etpinard Indeed! (The catch is here to provide a separate tickalign value for each tick).

  3. etpinard commented on Nov 27, 2018

    @etpinard
    Contributor

    .. or do something like https://plot.ly/javascript/reference/#layout-xaxis-showexponent with values "all" | "first" | "last" | "none"

  4. EBoisseauSierra commented on Nov 27, 2018

    @EBoisseauSierra
    Author

    that could be a solution.

    My initial thoughts were to be able to:

    • either set tickalign as a single [0,1] float, and apply this value to all ticks,
    • or set tickalign as a list of [0,1] floats (list with a length equal to the number of ticks displayed) and apply each tickalign respectively.
      (This might not be the best way to go, though, as it might be difficult to know in advance the number of ticks. Plus it's not efficient if you want to customise the last tick only… A workaround — yet limiting the "customisability" — would be to provide a list of length 3 only, for [first, middles, last]…)
  5. walter9388 commented on Apr 29, 2020

    @walter9388

    any update on this?

  6. 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions