8000 Raise when both singular and plural scatter attributes are specified · Issue #19120 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Raise when both singular and plural scatter attributes are specified #19120

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

Closed
mwaskom opened this issue Dec 15, 2020 · 4 comments · Fixed by #25794
Closed

Raise when both singular and plural scatter attributes are specified #19120

mwaskom opened this issue Dec 15, 2020 · 4 comments · Fixed by #25794

Comments

@mwaskom
Copy link
mwaskom commented Dec 15, 2020

Problem

plt.scatter accepts both singular and plural forms of the linewidth(s) and edgecolor(s) attributes. The plural forms are documented in the function signature, but the singular forms actually take precedence if both are specified.

This adds some complexity for downstream libraries and confusion for their users (cf. mwaskom/seaborn#2384).

Proposed Solution

Small change: Matplotlib could raise when both the singular and plural forms are specified.

Larger change: I will confess that I don't know why the plural forms of the kwargs exist. If there's not a strong reason for the duplication, perhaps they could be deprecated, or at least "formally discouraged"?

Additional context and prior art

Scatter does a lot of argument checking on the c/color parameters (too much at times, 😉), so there's some local precedence for a lot of handholding. On the other hand, matplotlib generally doesn't raise when both long- and short-forms of kwargs are given e.g. edgecolorandec`).

@jklymak
Copy link
Member
jklymak commented Jan 6, 2021

Well - there should be some consistency at least. I think @brunobeltran is looking at overhauling this?

@mwaskom
Copy link
Author
mwaskom commented Jan 6, 2021

Well - there should be some consistency at least.

new motto for matplotlib? :)

@jklymak
Copy link
Member
jklymak commented Jan 6, 2021

Consistent, community-developed, flexible with lots of features. You may choose two.

@tacaswell tacaswell modified the milestones: v3.5.0, v3.6.0 Aug 5, 2021
@QuLogic QuLogic modified the milestones: v3.6.0, v3.7.0 Jul 8, 2022
@QuLogic QuLogic modified the milestones: v3.7.0, future releases Jan 2 8000 4, 2023
@Luna-v0
Copy link
Luna-v0 commented Apr 30, 2023

Hello I would like to starting contributing, I came across this issue and I would like to know if this would be a possible fix on the scatter function

if linewidths is not None and kwargs.get('linewidth') is not None:
    raise TypeError('linewidths and linewidth cannot be used simultaneously.')
if edgecolors is not None and kwargs.get('edgecolor') is not None:
    raise TypeError('edgecolors and edgecolor cannot be used simultaneously.')

@Luna-v0 Luna-v0 mentioned this issue May 1, 2023
3 tasks
@QuLogic QuLogic modified the milestones: future releases, v3.8.0 May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
0