2
$\begingroup$

I have this BarChart:

BarChart[
  {{33/36, 3/36}, {27/36, 8/36, 1/36}, {13/36, 10/36, 2/36, 1/36, 1/36, 4/36, 1/36, 1/36}},
  ChartLabels -> 
    {{Style["Набор 1", Black, Bold, FontSize -> 24],
      Style["Set 2", Black, Bold, FontSize -> 24],
      Style["Set 3", Black, Bold, FontSize -> 24]},
      Placed[
        {Style["node 4", FontSize -> 18, White],
         Style["node 9", FontSize -> 18, White],
         Style["node 7", FontSize -> 18, White],
         Style["node 5", FontSize -> 18, White],
         Style["node 6", FontSize -> 18, White],
         Style["node 10", FontSize -> 18, White],
         Style["node 11", FontSize -> 18, White],
         Style["node 13", FontSize -> 18, White]},
        Center,
        Rotate[#, 0 Degree] &]},
  ChartStyle -> 
    {GrayLevel[0.1], GrayLevel[0.2], GrayLevel[0.25], 
     GrayLevel[0.3], GrayLevel[0.35], GrayLevel[0.4], GrayLevel[0.45], 
     GrayLevel[0.5]},
  ChartLayout -> "Stacked",
  ImageSize -> 1100,
  AxesStyle -> Directive[Black, 24],
  BarSpacing -> {0, 1.2}]

enter image description here

It can be noted that stack is formed from the min bar length to the max one but only in first two columns. I would like to locate nodes in Set 3 in descending order (from bottom to top), but it seems to me that I can't do that because I've already used Placed inappropriately in my case, or I just don't know the appropriate function.

Could someone help me or give some advice?

$\endgroup$
2
$\begingroup$
data = {{33/36, 3/36}, {27/36, 8/36, 1/36}, {13/36, 10/36, 2/36, 1/36, 1/36, 
  4/36, 1/36, 1/36}}; 
labels = Style[#, FontSize -> 18, White] & /@ {"node 4", "node 9", "node 7", 
   "node 5", "node 6", "node 10", "node 11", "node 13"};
grouplabels = Style[#, Black, Bold, FontSize -> 24] & /@ {"Набор 1", "Set 2", "Set 3"};
labeleddata = Labeled[##, Axis] & @@@ Transpose[{SortBy[-First[#] &] /@ 
 (MapIndexed[Labeled[#, labels[[#2[[1]]]], Center] &, #] & /@ data), grouplabels}];

BarChart[labeleddata, 
 ChartStyle -> {GrayLevel[0.1], GrayLevel[0.2], GrayLevel[0.25], 
   GrayLevel[0.3], GrayLevel[0.35], GrayLevel[0.4], GrayLevel[0.45], 
   GrayLevel[0.5]}, ChartLayout -> "Stacked", ImageSize -> 900, 
 AxesStyle -> Directive[Black, 24], BarSpacing -> {0, 1.2}]

enter image description here

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.