Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Description
Bug summary
After setting .set_picker(True), the pickradius wasn't a number anymore but a bool with value true.
Code for reproduction
'''Command <legend>.set_picker(True) sets also <legend>.get_pickerradius to 'True' '''importmatplotlib.pyplotaspltfig,ax=plt.subplots()ax.plot([0,1], [0,1],label='MyLabel')leg=ax.legend()legline=leg.get_lines()[0]legline.set_pickradius(5)# Set pickradius to fiveprint("should be five, not 'True':",legline.get_pickradius())# Check, if it is ok. Yes it is.legline.set_picker(True)# Turn on picking for this artist.print("should be five, not 'True':",legline.get_pickradius())# Check pickradius once more.# It is "True" now, not five. Why not five ? Where is my 'five' gone ?# In the following usage, which is not seen here, I noticed, the legendline was clickable, but it was hard to hit !# A workaround is, first set_picker(True) and afterwards set_pickradius(5). But it took me several time to find the problem.# If possible, please make it possible to set these values in both orders. It is much easier to understand.## Requirement already satisfied: pip in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (23.2.1)## Requirement already satisfied: matplotlib in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (3.7.2)## Requirement already satisfied: contourpy>=1.0.1 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (1.1.0)## Requirement already satisfied: cycler>=0.10 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (0.11.0)## Requirement already satisfied: fonttools>=4.22.0 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (4.42.0)## Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (1.4.4)## Requirement already satisfied: numpy>=1.20 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (1.25.2)## Requirement already satisfied: packaging>=20.0 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (23.1)## Requirement already satisfied: pillow>=6.2.0 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (10.0.0)## Requirement already satisfied: pyparsing<3.1,>=2.3.1 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (3.0.9)## Requirement already satisfied: python-dateutil>=2.7 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from matplotlib) (2.8.2)## Requirement already satisfied: six>=1.5 in c:\users\norbert\appdata\local\programs\python\python311\lib\site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
Actual outcome
should be five, not 'True': 5
should be five, not 'True': True
Expected outcome
should be five, not 'True': 5
should be five, not 'True': 5
Additional information
Do you maybe even know a fix?
First do set ".set_picker(True)", afterwards .set_pickradius(5)
Operating system
Windows
Matplotlib Version
3.7.2
Matplotlib Backend
TkAgg
Python version
Python 3.11.4
Jupyter version
No response
Installation
pip