Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

There are a lot of questions here about formatting of barcharts, but I couldn't find one matching mine. I seek to display data in stacked format, labeling each component of the stack and the total for each bar. I can't make it work for the life of me.

As a starting place, consider

BarChart[{{1, 2}, {2, 3}, {2, 4}}, ChartLayout -> "Stacked", 
 ChartLabels -> {Range[2004, 2006], None}]

I want each component labeled as below --

goal

My efforts to date result in some pieces appearing but never all, and often in the wrong places.

share|improve this question

1 Answer 1

up vote 6 down vote accepted
BarChart[Labeled[#, Total[#], Above] & /@ {{1, 2}, {2, 3}, {2, 4}}, 
         ChartLayout -> "Stacked", ChartLabels -> {Range[2004, 2006], None}, 
         LabelingFunction -> (Placed[#1, Center] &)]

enter image description here

share|improve this answer
    
+1 was about to post but you got there while I was still eating my breakfast :) –  Mike Honeychurch Jun 12 at 22:52
    
@MikeHoneychurch: LOL, I'm usually last to the party re:plotting/graphics against you and other plot wizards - it just happens I needed this very layout not long ago... thanks for + ! –  rasher Jun 12 at 23:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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