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

[Bug]: Customizing Slider appereance #27672

Open
@shcrela

Description

@shcrela

Bug summary

Hi all,

I was trying to change the slider handle style....

First, if you try something like suggested in the docs :

my_slider=Slider(ax,'frame',0,10,handle_style={"style":"^","size":20,"facecolor":"r"})

You get:
AttributeError: Line2D.set() got an unexpected keyword argument 'markerstyle'

Then, I switched to:

my_slider=Slider(ax,'frame',0,10,handle_style={"":"^","size":20,"facecolor":"r"})

And this worked well, except for the annoying warning:
UserWarning: marker is redundantly defined by the 'marker' keyword argument and the fmt string "o" (-> marker='o'). The keyword argument will take precedence.

I believe there's an easy fix to this issue:

  1. Include :'marker': 'o' in thedefaultsdict. (line 457 in widgets.py)
  2. Remove"o" when plotting the handle (line 488 in widgets.py)
  3. Update the docs to indicate that an empty string instead of "style" is needed to change the marker style.

I would be honoured to make the modifications myself, but I believe I would need some guidance on how to contribute.

Cheers!

Code for reproduction

importmatplotlib.pyplotaspltfrommatplotlib.widgetsimportSliderfig,ax=plt.subplots()my_slider=Slider(ax,'frame',0,10,handle_style={"style":"^","size":20,"facecolor":"r"})ORmy_slider=Slider(ax,'frame',0,10,handle_style={"":"^","size":20,"facecolor":"r"})

Actual outcome

First output
AttributeError: Line2D.set() got an unexpected keyword argument 'markerstyle'

Second output:
UserWarning: marker is redundantly defined by the 'marker' keyword argument and the fmt string "o" (-> marker='o'). The keyword argument will take precedence.

Expected outcome

To change the slider handle from circle into a triangle without a warning.

Additional information

I believe there's an easy fix to this issue:

  1. Include :'marker': 'o' in thedefaultsdict. (line 457 in widgets.py)
  2. Remove"o" when plotting the handle (line 488 in widgets.py)
  3. Update the docs to indicate that an empty string instead of "style" is needed to change the marker style.

Operating system

MacOS 14.2.1

Matplotlib Version

3.7.2

Matplotlib Backend

qt

Python version

3.9.18

Jupyter version

4.0.8

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp