How to R: Making Better Histograms

1. Bin widths

We want to make sure the bin widths are easily understood by the audience, in this case we have votes on a discrete 0–10 scale. For now the bin widths are pretty difficult to tell how far they travel, my guess is a little less than 0.5 but the fact that it is hard to tell does not make it very interpretable for others. Let’s change the bin widths to be 1 wide, so that there should be a total of 10 bins.

2. Data Labels

One thing you want to make sure to do is make it as easy as possible for your audience to grasp the size of each bin, not just the relative sizes each bin has to one another. For now, if you present this to someone they will have to use the y-axis to identify how many movies have a 5 rating. This can be done but it does make your audience have to take time to get that information. To make it clear and easy to read we can add data labels to the top of each bar.

3. Descriptive Statistics

Assuming you are presenting this chart and only this chart to your audience, there are a few key descriptive statistics that are still missing. Your audience would probably be most interested in the mean rating for the entire population of horror movies voted on, as well as the total number of movies that was voted on.

4. Colors/Highlighting

Now that we have most of our graph set up for the presentation, we can think about another key aspect to our visual, the colors and highlighting. For now the bars are set in a dark grey with a grey background. We see the information we need to see, but it is pretty bland. Let’s add some color to it and highlight our descriptive statistics so they pop a bit more.

5. Formatting and Titles

Finally let’s put this altogether. There are still some missing pieces to our chart, such as the title, updating the axis titles, and taking care of formatting across our various labels. This should help us put everything together and continue to make it easier to read.

  • Increased the size of all data labels to size = 6. With them being bigger, they are easier to read.
  • Updated the line color, type, and size of for the average rating line. Now it matches the color of its label and is a little bigger so it stands out more.
  • Made the labels for “Number of Movies” and “Overall Average Rating” to be bigger and pushed them further up the y axis, so there was more space between them and the data labels. I italicized these to make a point that these are special and descriptive statistics.
  • Updated the theme of the graph by removing the grey background and adding black lines for each axis. I then reset the size of all of the font for the title (which I also added), and the axis titles.
  • Set the bars of the histogram to be flush with the x-axis, and removed the buffer that was there before.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store