Skip to content
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

Spikes in small wedges of a pie chart #6828

Closed
bronger opened this issue Jul 25, 2016 · 11 comments
Closed

Spikes in small wedges of a pie chart #6828

bronger opened this issue Jul 25, 2016 · 11 comments
Labels
backend: svg Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Milestone

Comments

@bronger
Copy link

bronger commented Jul 25, 2016

The following applies to Python3 + matplotlib 1.5.1.

http://wilson.bronger.org/software.svg exhibits ugly spikes in the small wedges of this pie chart. After importing the SVG into Inkscape, the problem is even worse but can be fixed by changing the style of line vertices to "rounded".

The code is:

from matplotlib import pyplot
import matplotlib

figure = pyplot.figure()
axes = figure.gca()
axes.pie([23, 22, 2, 42, 1, 34, 17, 21, 15, 290, 897],
         labels=["Fedora", "CKAN", "dLibra" + 8 * " ", "DSpace",
                 "eSciDoc", "DataVerse", "EPrints", "MySQL", "Nesstar",
                 "sonstige", "unbekannt"],
         explode=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.15],
         wedgeprops={"clip_on": True, "capstyle": "round"},
         shadow=True, startangle=150)
axes.set_aspect("equal")
figure.savefig("software.svg", bbox_inches="tight", transparent=True)
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Jul 28, 2016
@tacaswell tacaswell added the Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues label Jul 28, 2016
@tacaswell tacaswell modified the milestones: 2.0 (style change major release), 2.1 (next point release) Jul 28, 2016
@tacaswell
Copy link
Member

I am not sure that this is a bug in mpl. PNG output looks correctly and you report that this is svg render dependent.

so

Maybe the default capstyle in pie plots should be changed to rounded?

@bronger
Copy link
Author

bronger commented Jul 28, 2016

Is the PNG generated via SVG as an intermediate step?

@bronger
Copy link
Author

bronger commented Jul 28, 2016

Maybe the default capstyle in pie plots should be changed to rounded?

+1

@tacaswell
Copy link
Member

No, the png is directly rasterized using Agg.

@bronger would you be willing to take a crack at changing that default?

@bronger
Copy link
Author

bronger commented Jul 28, 2016

No, I'm sorry. Although I acknowledge that this is a low-hanging fruit, I would have to dive into matplotlib's source code just for this (never hacked on it).

Besides, I found PDF export as a workaround, which is imported by Inkscape loss-less.

@tacaswell
Copy link
Member

@bronger I think these changes would be limited to the def pie(self, ...) method in axes/_axes.py. It would be a very shallow dive.

@LindyBalboa
Copy link
Contributor

LindyBalboa commented Jul 28, 2016

I checked this out on mpl 1.5.1 and python 3.5. Setting wedgeprops={'capstyle': 'round'} had no effect in IE, Firefox, and Chrome. I also tested 'projecting' and that did not help as either. @tacaswell I think you were right that this might not be an mpl issue.

Edit to add: .eps is slightly distorted at the tip, .ps is badly distored, but .pdf is totally fine.

@bronger
Copy link
Author

bronger commented Jul 29, 2016

Had wedgeprops={'capstyle': 'round'} effect for PDFs?

@LindyBalboa
Copy link
Contributor

LindyBalboa commented Jul 29, 2016

@bronger Nope, wedgeprops={'capstyle': 'round'} didn't seem to have an effect on any of the formats as far as my standard Anaconda install goes.

@QuLogic
Copy link
Member

QuLogic commented Aug 4, 2016

I don't know what caused it, but the output appears fine when running on the v2.x branch. It may already be fixed.

@tacaswell
Copy link
Member

Closed as not reproducible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: svg Difficulty: Easy https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Projects
None yet
Development

No branches or pull requests

4 participants