Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow option to display absolute values for pie chart #19338 #25757

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
wants to merge 2 commits into from
Closed

Allow option to display absolute values for pie chart #19338 #25757

wants to merge 2 commits into from

Conversation

codebreakymefix
Copy link

@codebreakymefix codebreakymefix commented Apr 24, 2023

PR Summary

Adds a parameter 'wedgelabels' to pie() for the user to display absolute or percent values in the wedges. Renamed 'autopct' to "wedgelabelsfmt" as the user requested.

closes #19338

PR Checklist

Linked Issue

  • Added "closes #0000" in the PR description to link it to the original issue.

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

codebreakymefix and others added 2 commits April 23, 2023 20:59
chart #19338

Added a paramter wedgelabels to the pie() so the user can choose if
they values are absolute or percentages. Renamed autopct with
wedgelabelsfmt as the user requested.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

Copy link
Member

@oscargus oscargus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

It is not clear to me how this works in practice. Right now, both autofmt and wedgelabelsfmt does the same thing? If so, why should we have both? If not, how can we deprecate autofmt later?

If it is only a matter of a "bad" name, then I think it is better to just have one name and use the decorator @_api.rename_parameter("3.8", "autofmt", "wedgelabelsfmt").

However, I would wait for additional input before going all in on these changes. (New arguments after * is a requirement though.)

Edit: after reading the issue, I think it should be quite OK to add the decorator as well.

wedgeprops=None, textprops=None, center=(0, 0),
autopct=None, wedgelabels=None, wedgelabelsfmt=None, pctdistance=0.6,
shadow=False, labeldistance=1.1, startangle=0, radius=1,
counterclock=True, wedgeprops=None, textprops=None, center=(0, 0),
frame=False, rotatelabels=False, *, normalize=True, hatch=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new arguments must be added after the * in case someone is using positional arguments.

@story645
Copy link
Member

I get the need and support supporting it, but I'm very iffy on coupled keywords - (wedgelabels, wedgelabelfmt) and would prefer an 'absolutefmt' keyword w/ the instruction that you cannot use both. Either way, I think wedgelabels is confusing cause labels is also confusing and we're really labeling the categories and amounts (maybe intertior labels?)

And, as mentioned in the checklist, once settled this will need an example (I suggest adding it to the pie demo).

@rcomer
Copy link
Member

rcomer commented Sep 29, 2023

Hi @codebreakymefix are you still interested in working in this? It looks like maybe you were waiting for reviewers to reach a consensus.

I think I agree with @story645 on this that the proposed wedgelabels could be confusing. As the pie example shows, the current labels can be put on the wedge and the automatic percentage labels outside.

Perhaps autolabels and autolabelfmt rather than wedge… might work? Or I also like @story645’s suggestion of an “absolute” format keyword that can’t be passed together with autopct.

@rcomer rcomer added the status: needs comment/discussion needs consensus on next step label Sep 29, 2023
@rcomer
Copy link
Member

rcomer commented Oct 15, 2023

Discussion on parameter name also needs to consider the pctdistance parameter.

@codebreakymefix codebreakymefix closed this by deleting the head repository May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs decision
Development

Successfully merging this pull request may close these issues.

Allow option to display absolute values for pie chart
5 participants