pie chart color standardization

8 visualizaciones (últimos 30 días)
Tyson Smith
Tyson Smith el 31 de Mayo de 2019
Respondida: Tyson Smith el 14 de Ag. de 2019
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.

Respuestas (2)

Johan Baijot
Johan Baijot el 12 de Ag. de 2019
Editada: Johan Baijot el 12 de Ag. de 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.

Tyson Smith
Tyson Smith el 14 de Ag. de 2019
Thank you. I will try this out.

Categorías

Más información sobre Pie Charts en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by