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

Line2D.contains does not take drawstyle into account. #6447

Closed
Milestone
@anntzer

Description

@anntzer

Seejoferkington/mpldatacursor#36.
Briefly,Line2D.contains currently assumes that points in the line are connected by straight segments, thus ignoringdrawstyle. Minimal example (edited from the event handling doc):

import numpy as npimport matplotlib.pyplot as pltfig = plt.figure()ax = fig.add_subplot(111)ax.set_title('click on points')line, = ax.plot(np.random.rand(10), picker=5, drawstyle="steps-pre")  # 5 points tolerancedef onpick(event):    thisline = event.artist    xdata = thisline.get_xdata()    ydata = thisline.get_ydata()    ind = event.ind    points = tuple(zip(xdata[ind], ydata[ind]))    print('onpick points:', points)fig.canvas.mpl_connect('pick_event', onpick)plt.show()

Clicking on the drawn line does not always trigger an event. Clicking on the not-drawn "straight" segments connecting the data points does.

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