Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

colored bar plot sorted by value

1 visualizzazione (ultimi 30 giorni)
Jan Böttner
Jan Böttner il 5 Giu 2019
Chiuso: MATLAB Answer Bot il 20 Ago 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.

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by