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

RectangleSelector does not work if start and end points are identical #10075

Closed
@Rolf-Hempel

Description

@Rolf-Hempel

Bug report

If in a RectangleSelector the mouse does not move between button press and button release, wrong values for start and end coordinates are returned. It seems to me that those coordinates correspond to the last callback where the mouse had been moved between press and release.

The following example code in theMatplotlib documentation illustrates the consequences:

from pylab import *def onselect(eclick, erelease):  'eclick and erelease are matplotlib events at press and release'  print(' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata))  print(' endposition   : (%f, %f)' % (erelease.xdata, erelease.ydata))  print(' used button   : ', eclick.button)def toggle_selector(event):    print(' Key pressed.')    if event.key in ['Q', 'q'] and toggle_selector.RS.active:        print(' RectangleSelector deactivated.')        toggle_selector.RS.set_active(False)    if event.key in ['A', 'a'] and not toggle_selector.RS.active:        print(' RectangleSelector activated.')        toggle_selector.RS.set_active(True)x = arange(100)/(99.0)y = sin(x)fig = figureax = subplot(111)ax.plot(x,y)toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line')connect('key_press_event', toggle_selector)show()

**If you start with drawing a line, everything works fine. If you then move the mouse to a different point, click it and release it without moving, the previous line shows up again (and the old coordinates are printed to stdout). If you draw a line from upper left to lower right, the detached line makes weird movements.

The example program works correctly with Matplotlib version 1.4.2.

Matplotlib version

  • Operating system: Windows 7 Professional 64bit
  • Matplotlib version: 2.1.1
  • Matplotlib backend (print(matplotlib.get_backend())): qt5agg
  • Python version: 3.6.3
  • Jupyter version (if applicable): -
  • Other libraries: -

I installed matplotlib with miniconda from the default channel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp