pie chart color standardization

조회 수: 10 (최근 30일)
Tyson Smith
Tyson Smith 2019년 5월 31일
답변: Tyson Smith 2019년 8월 14일
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.

답변 (2개)

Johan Baijot
Johan Baijot 2019년 8월 12일
편집: Johan Baijot 2019년 8월 12일
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.

Tyson Smith
Tyson Smith 2019년 8월 14일
Thank you. I will try this out.

카테고리

Help CenterFile Exchange에서 Pie Charts에 대해 자세히 알아보기

태그

제품


릴리스

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by