MATLAB: Data labels above bars on grouped bar plot

barplotgroupedtext labels

I'm making a grouped bar plot (i.e., a bar plot with multiple bars in each category). I would like to add labels at the top of each bar to indicate its height. I was planning to just use the text function. However, bars within a given group all have the same x location (i.e get(h,'XData') is the same for all bar series). I'm not sure how to find the proper x location for each bar within a given group. Any ideas?
Thanks, Justin

Best Answer

You're on the right track, the center of each group is at the axis tick value. For each bar in the group, use that value plus/minus a delta to locate the x position for your text.
I did an example of this for another poster within the last few weeks at most altho I don't have the link at hand. Perhaps a search will uncover it.
ADDENDUM:
OK, I looked at past answers--this one is pretty close altho I thought I did another. Maybe it was in the newsgroup instead...