3
$\begingroup$

Consider a pie chart as follows

PieChart[Normalize@RandomReal[1, 10], SectorOrigin -> {Automatic, 1}, 
 ChartStyle -> RandomColor[10], ColorFunction -> (EdgeForm[None] &)]

The corresponding chart is

enter image description here

If one looks closely at the chart, one can find the white edges (one such sample is outlined in the chart). I want a smooth pie chart without any such edge.

How can I do this?

$\endgroup$
  • $\begingroup$ Out of curiosity, does this problem persist if you Rationalize the inputs? This might help avoid rounding error. (I'd try it out myself, but my institution is currently migrating their Mathematica license server...) $\endgroup$ – Michael Seifert Jul 27 '18 at 13:58
  • $\begingroup$ @MichaelSeifert yes, the problem still persists. $\endgroup$ – Majis Jul 27 '18 at 14:10
5
$\begingroup$
SeedRandom[1]
ini = PieChart[Normalize@RandomReal[1, 10], SectorOrigin -> {Automatic, 1},
         ChartStyle -> RandomColor[10], ColorFunction -> (EdgeForm[None] &)];

The annulus pieces probably partition the complete one as good as exactly, but maybe the rendering rounds off badly. From the output of head @@ ini, you can see that the style of each piece is a Directive with the form Directive[col, EdgeForm[None]].

Replacing those with appropiate EdgeForms can counteract the bad rounding:

ini /. Directive[col_, EdgeForm[___]] :> Directive[col, EdgeForm[{col, Thickness[1/1000]}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.