Skip to content

axvline incorrectly tries to handle unitized ymin, ymax #12198

Closed

Description

@anntzer

After

line = plt.axvline(
    x=.5, ymin=matplotlib.dates.num2date(1), ymax=matplotlib.dates.num2date(1.05))
line.set_clip_on(False)

and panning the axes around, one sees that matplotlib (3.0) converted ymin and ymax to the scalar values 1 and 1.05, which is not correct: ymin and ymax are values relative to the axes bounds and thus intrinsically unitless; passing unitized data to ymin or ymax should result in an error.

The same point likely applies to axhline, axvspan, axhspan.

Activity

  1. added this to the v3.0.x milestone on Sep 21, 2018
  2. modified the milestones: v3.0.x, v3.1 on Oct 22, 2018
  3. jklymak commented on Feb 11, 2019

    @jklymak
    Member

    This is still a bug...

  4. modified the milestones: v3.1.0, v3.2.0 on Feb 11, 2019
  5. worthy7 commented on Aug 5, 2019

    @worthy7

    image

  6. modified the milestones: v3.2.0, v3.3.0 on Aug 26, 2019
  7. QuLogic commented on May 7, 2020

    @QuLogic
    Member

    I don't understand what panning has to do with this?

  8. anntzer commented on May 7, 2020

    @anntzer
    ContributorAuthor

    it's just to show that 1 and 1.05 have been interpreted as dates, not unitless axes-coordinates values.

  9. QuLogic commented on May 7, 2020

    @QuLogic
    Member

    But they haven't, they were converted back to a numerical value of 1/1.05 (which is probably still wrong). Panning around, the line always stays above the Axes.

  10. anntzer commented on May 7, 2020

    @anntzer
    ContributorAuthor

    Oops sorry, I guess I misremebered the example's behavior... Well, backconversion to unitless values is also wrong :)

  11. modified the milestones: v3.3.0, v3.4.0 on May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions