Numbers in bar graphs

May 22, 2009

I spent far too much time today figuring out how to put numbers in bar graphs. i.e. how to transform this:
graph_nonums

into this:

graph_nums

When reading papers, I often wish numbers were included like this, and so resolved a while ago to always do so myself.  Plotting the numbers allows someone else to replot them when doing some sort of a comparison.  (With out needing to implement your algorithm, or ask you for your doubtlessly long-lost data, or (ugh) physically measuring the lengths of your bars.)  However, now seeing how tedious this can be, I understand why it is rarely done.

In any case, I wrote a function add_bar_nums.m that you can run after doing a bar plot that will add the numbers like above.  There are options for rotating the text, changing the display format, etc.

Tags: , ,

2 Responses to “Numbers in bar graphs”

  1. nimit Says:

    Just a different viewpoint. If those values are not so different, like in your example, why do you want to show a graph anyway? Why not just report numbers (e.g. in a table)? On the other hand, when values are so apparently different, a graph may not need numbers to be put on the bars. Anyway, your function add_bar_nums.m will be helpful as we can decide whether to put numbers or not :-)

  2. justindomke Says:

    I agree that graph is very boring! I’m not sure why the limits are set so poorly, either…


Leave a Reply