Skip to content

[ENH]: Make rubber band more visible #23969

Closed

Description

@komoto48g

Problem

If the image is dark such as diffraction patterns, the rubber band is hardly visible.

Proposed solution

Candidates would be,

  1. Draw xor masked line (similar to Cursor).
  2. Paint with a semi-transparent color inside the rectangle (similar to ver 3.3.4).

Clipboard01

Activity

  1. QuLogic commented on Sep 20, 2022

    @QuLogic
    Member

    With what backend? The rubber band should be alternating black and white in most (but not all in 3.5.3, IIRC.)

  2. anntzer commented on Sep 21, 2022

    @anntzer
    Contributor

    IIRC it's wx which used that colored rectangle previously. Currently it doesn't draw the white dashes; seems straightforward enough to add that. Looking at other backends, I believe tk and macos also need the improvement.
    Marking as good first issue (but medium as you need to fiddle with GUI toolkits (and ObjC for the macos backend) -- it's not necessary for a PR to handle all backends at once).

  3. oscargus commented on Sep 21, 2022

    @oscargus
    Member

    The MacOS-backend has a separate issue with a bit of possibly useful details: #23777

  4. oscargus commented on Sep 21, 2022

    @oscargus
    Member

    For wx one can add the following line

                drawDC.DrawLineList(
                    [(x0, y0, x1, y0), (x1, y0, x1, y1),
                     (x0, y0, x0, y1), (x0, y1, x1, y1)],
                    wx.Pen('WHITE', 1, wx.PENSTYLE_SOLID))

    before

    drawDC.DrawLineList(
    [(x0, y0, x1, y0), (x1, y0, x1, y1),
    (x0, y0, x0, y1), (x0, y1, x1, y1)],
    wx.Pen('BLACK', 1, wx.PENSTYLE_SHORT_DASH))

    to get a black-white-line as discussed in #23777

    wx does not support 0-length dashes, so one cannot start with a gap (as far as I can tell).

    Bonuses:

    • Only create the point-list once per call
    • Only create the pens once per CanvasBase instance.
  5. komoto48g commented on Sep 21, 2022

    @komoto48g
    Author

    Thank you for your consideration of this issue. I tested on Windows 10 with matplotlib 3.5.3/WxAgg and TkAgg. The two seem slightly different:
    WxAgg => black dashed line
    TkAgg => black solid line
    The black and white line is also nice.

  6. added this to the v3.6.1 milestone on Sep 23, 2022
  7. modified the milestones: v3.6.1, v3.6.2 on Oct 6, 2022
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