8000 Update Selection Widgets · Issue #3486 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content 8000
Update Selection Widgets #3486
Closed
Closed
@blink1073

Description

@blink1073

I took a stab at updating the selection widgets. Namely, improving the RectangleSelector and LassoSelector, and adding new EllipseSelector, PaintSelector and LineSelector widgets. These are based on a proof of concept I made called image inspector, which in turn is based on the scikit-image canvastools.

I created a gist that demonstrates all the widgets.

Improvements to RectangleSelector:

  • Visible handles for manipulating the shape after it has been drawn
  • Keyboard modifiers:
    • Alt moves the existing shape (as does dragging the center handle)
    • Shift makes the shape square (or circular)
    • Ctrl makes the initial point the center of the shape (helpful for ellipses)
    • Ctrl and shift can be combined
  • When drawmode == 'line', actually draw the outline instead of a single line

The API is the same, but the default drawmode has been changed to 'patch', while allowing 'box' to alias to 'patch'. Also, the shape is no longer invisible after been drawn (so we can interact with it).

Improvements to LassoSelector:

  • Unified API with RectangeSelector
  • Keyboard modifier:
    • Shift enables polygon mode where it draws straight lines

Note that LassoSelector had two methods that were renamed: onpress -> press and onrelease -> release. The old methods could be kept, and call the new methods while giving a deprecation warning.

Here is a screenshot of the Ellipse tool:
image

How would you like me to proceed? Throw them all into one PR?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0