pie chart color standardization
7 views (last 30 days)
Show older comments
I am trying to put together a script that will produce a bunch (108) of pie charts that all use the same color scheme for each of the 8 elements from which they are comprised. In many of the pie charts 1 or more of the 8 elements have a zero value, which appears to be an issue in early trials where I am only making a few pie charts at a time. The issue observed is that each pie chart will define its own color scheme so that the same element will be shaded differently from one chart to the next (e.g., element 2 is shaded blue in pie chart 1 and blue-green in pie chart 2). This appears to be dependent on the number of nonzero elements within a given pie chart (e.g. pie chart 1 has 6 nonzero elements and pie chart 2 has 8 nonzero elements).
So, does anyone know how to have a consistent coloring scheme of pie chart elements for multiple pie charts when many of the pie charts will be missing 1 or more of these elements?
Thanks.
0 Comments
Answers (2)
Johan Baijot
on 12 Aug 2019
Edited: Johan Baijot
on 12 Aug 2019
As I had a similar problem I adapted the script.
So this script does not elimite imputs 0 anymore, but it still create an invisible patch and makes the label appears empty.
As such I can trick the code in thinking there is chart of the pie with size 0 and it skips that colour and still shows this section when I add a legend. As you mentioned before pretty handy when comparing different pie charts an have an empty group in one of them.
0 Comments
See Also
Categories
Find more on Pie Charts in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!