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:
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.

About these ads
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

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

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s