-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Validation not performed for loc
argument to legend
#24605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The work here is to :
This is a good first issue because it should only require understanding a narrow section of the code and no API design (it is already broken for these inputs, we just want it to break better). |
Hi. can i try this? |
@sod-lol Please do! We do not really assign issues or require you to get permission before you start working on an issue. |
@tacaswell hello sir can you give me some resources to work on this issue |
@tacaswell i want to work on this,please assign this issue to me |
@Gairick52 there is already a PR for this.... |
@iofall Hello sir,i want to work on this issue,please assign this to me |
Only maintainers can assign people to issues. Also, there is already a PR linked to this issue. You can try finding other issues to work on or provide any inputs if you have to the already linked PR. |
@iofall please share me beginner's developer's guide |
Here is the link to the contributing guide - https://matplotlib.org/devdocs/devel/contributing.html |
I picked up this ticket, continuing the previous work of @jpjepko (The new PR has him as a co-author). I added the new check to allow the numeric mappings to string values. Because words are hard, the value error message that is raised is a bit awkward. I'm not sure what to call the valid option of a string numeric value in the error message. It is currently omitted in the error message. Let me know if anyone has a suggestion or if I should just leave it like it is. |
I see this issue is still open. Does the PR #25281 not fix this? Can someone help elucidate me on it? |
Hi @adityasingh22, this issue will close when #25281 is merged. |
Bug summary
When passing non-str
loc
values tolegend
, validation is not performed. So even for invalid inputs, errors are raised only when we callshow()
Code for reproduction
Actual outcome
Expected outcome
Errors should be raised when invalid arguments are passed to
loc
. Similar to what we get when we pass an invalid string value as shown:Additional information
matplotlib/lib/matplotlib/legend.py
Lines 608 to 615 in ab7917a
No validation is done when setting values for
_loc_real
. We do check strings on line 473, which is why we don't face this issue there.Operating system
Windows
Matplotlib Version
3.6.2
Matplotlib Backend
'TkAgg'
Python version
3.9.7
Jupyter version
No response
Installation
pip
The text was updated successfully, but these errors were encountered: