Numbers in bar graphs

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

into this:


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.


3 thoughts on “Numbers in bar graphs

  1. 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. I agree that graph is very boring! I’m not sure why the limits are set so poorly, either…

  3. I really need to find a bar graph for my homework and I counting on this website to help me find it

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s