Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
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:
- Include :
'marker': 'o'
in thedefaults
dict. (line 457 in widgets.py) - Remove
"o"
when plotting the handle (line 488 in widgets.py) - 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 outputAttributeError: 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:
- Include :
'marker': 'o'
in thedefaults
dict. (line 457 in widgets.py) - Remove
"o"
when plotting the handle (line 488 in widgets.py) - 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