Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bad event index for step plots #6615

Closed
Closed
Milestone
@anntzer

Description

@anntzer

#6497 (checked by bisection) let to pick events reporting incorrect events for step plots.

MWE:

from pylab import *plot(rand(100), picker=5, drawstyle="steps-pre")  # 5 points tolerancedef on_pick(event):    print(event.ind)cid = gcf().canvas.mpl_connect('pick_event', on_pick)show()

On 1.5.1, clicking on the "right" part of the plot reports an index close to 100 (that is, the number of points). On master, the index is instead close to 200 (because each point is "duplicated" in the path).

While the previous behavior could "easily" be restored, it may be a good time to revisit what the "index" returned byLine2D.contains actually means. Specifically:

  • For non-step plots, I think the indices should actually be floats, that indicate where between which two points the projection of the click onto the line falls (for each line for which the projection is close enough), and how close to each extremity of the segment. (This would be only a minor backwards incompatibility if the returned index is used, well, to index the data: recent numpys would emit a warning about indexing with a float.)
  • For step plots, it is less clear what the correct solution is. Perhaps keeping the status quo and returning the index of the preceding point(s) would be enough.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp