-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH]: Ability to Swap autopct and label positions #24789
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
Hello, I'd like to contribute on this issue. |
Hi @vitorfrois, I recommend that you wait until a few maintainers have chimed in on whether this feature should go into matplotlib and hashed out an API- if you have suggestions you're welcome to propose them. Otherwise (and possibly either way) this will get hashed out on the PR. The request seems reasonable to me but I'm not sure whether the API would be simple enough to be feasible- do we want three more kwargs on this plotting method, is there a more straightforward way to do this (was thinking allow label and autoprct to take each other's kwargs but that will maybe be messy internal logic) or is it simple? |
If you've already implemented something, you're more than welcome to open the PR. I'm just trying to be upfront that it may not get in.
Does this padding work for all wedge sizes/ a wide range of percentages?
I think this is cleaner than my proposal (I was thinking of label and prct locations cause that would provide lots of flexibility) but I'm not totally sold on whether this or a more general solution makes more sense. |
I'm not in favour of this request: |
I didn't know about those and should have checked 😶 but then maybe the resolution here is to better documenting that by adding a section to https://matplotlib.org/devdocs/gallery/pie_and_polar_charts/pie_and_donut_labels.html#sphx-glr-gallery-pie-and-polar-charts-pie-and-donut-labels-py |
You can make it more explicit if you like, but the documentation is readily available - not everything needs to be spelled out explicitly in an example. |
Are |
They are the same, but they should be spelled the same here. |
Just do it. Reorder according to the signature and then move shadow one place. Nobody will notice. Additionally, we can start a kwarg only deprecation at explode to have the ability of reordering the signature in the future. |
I also have this question about the sanctity of the signature and matching things up w.r.t. #24470 b/c I currently put hatch next to color and really don't want it at the bottom. |
example cleaned pct and label positioning arg docs b/c of matplotlib#24789
OK! Then I think that spelling them the same way (not clear which, I may be inclined to think that radial distance is a bit clearer, although that is also expressed as a ratio, so the unit of the value is not so clear) will take this a long way. |
I'm a bit against not having the parameters in the "correct" order, but on the other hand pro making most methods with gazillion arguments keyword only after the most obvious ones (like data being positional, styling kw-only). (btw, the current doc-string is already out of order with |
The rough order should be the same, but I think nobody will be confused or complain if the signature is
but the documentation is
Personally, I mostly ignore the parameters in the signature because the parameter list is much more readable: https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.pie.html#matplotlib.axes.Axes.pie |
My take on this:
|
expanded basic pie example to include small examples of labels, autopct, colors, and hatch cleaned pct and label positioning arg docs b/c of matplotlib#24789
expanded basic pie example to include small examples of labels, autopct, colors, hatch, and distance reworded pctdistance and labeldistance b/c of matplotlib#24789
expanded basic pie example to include small examples of labels, autopct, colors, hatch, and distance reworded pctdistance and labeldistance b/c of matplotlib#24789 fixed link
expanded basic pie example to include small examples of labels, autopct, colors, hatch, and distance reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com>
reworded pctdistance and labeldistance b/c of matplotlib#24789 Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com> Co-authored-by: sledziu32 <sledziu32@gmail.com> Co-authored-by: Jody Klymak <jklymak@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
added small examples of labels, autopct, colors, hatch, and distance in an attempt to scaffold up to exploding example addresses some of matplotlib#24789 Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com> Co-authored-by: David Stansby <dstansby@gmail.com>
I think that this can be closed now. There is an example explicitly showing this: https://matplotlib.org/devdocs/gallery/pie_and_polar_charts/pie_features.html#swap-label-and-autopct-text-positions and the documentation is updated: |
Problem
It would be nice to be able to have the labels applied on top of pie chart slices, rather than on the edges. Likewise, it would be nice to have the percentages on the outside of the pie chart slices instead of on the inside.
Proposed solution
Allow an option to swap the autopct and label positions. Also, allow the autopct position to be autorotated via a flag like rotateautopct.
The text was updated successfully, but these errors were encountered: