Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

colored bar plot sorted by value

1 visualización (últimos 30 días)
Jan Böttner
Jan Böttner el 5 de Jun. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I need to make a plot in which my values are sorted descending (percentages, 0 to 100).
There are 11168 values in total and they belong to 16 different categories. So when they are sorted, they are obviously not in the order 1:11168, but pretty random. The categories have different ranges, so eg cat1 = 1:1112, cat2 = 1113, cat3 = 1114:2109, etc. But when sorted, they as well are kind of random. I'd like to have one color per categorie, so the colors spread over the plot like shown in my scatch.
Does anyone have an idea how i can do this? I manage to make a line plot of the sorted percentages but when i want to add a bar plot, it will always be on the left side as you can see, instead of being distributed all over the line plot.
figure
hold
plot(Autarkiegrad_je_Gemeinde(:,2))
bar(Autarkiegrad_je_Gemeinde(1:1112,2))
bar(Autarkiegrad_je_Gemeinde(1113,2))
bar(Autarkiegrad_je_Gemeinde(1114:2109,2))
bar(Autarkiegrad_je_Gemeinde(2110:2111,2))
bar(Autarkiegrad_je_Gemeinde(2112:2507,2))
bar(Autarkiegrad_je_Gemeinde(2508:2937,2))
bar(Autarkiegrad_je_Gemeinde(2938:5243,2))
bar(Autarkiegrad_je_Gemeinde(5244:6346,2))
bar(Autarkiegrad_je_Gemeinde(6347:8445,2))
bar(Autarkiegrad_je_Gemeinde(8446:8497,2))
bar(Autarkiegrad_je_Gemeinde(8498,2))
bar(Autarkiegrad_je_Gemeinde(8499:8916,2))
bar(Autarkiegrad_je_Gemeinde(8917:9672,2))
bar(Autarkiegrad_je_Gemeinde(9673:10101,2))
bar(Autarkiegrad_je_Gemeinde(10102:10319,2))
bar(Autarkiegrad_je_Gemeinde(10320:11168,2))
In the file added, the first colum has the number, the seccond has the value and the third is the category.

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by