From the course: Data Visualization in R with ggplot2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Histograms

Histograms

From the course: Data Visualization in R with ggplot2

Start my 1-month free trial

Histograms

- [Instructor] Histograms are a special case of bar graphs that allow us to work with continuous variables that don't easily lend themselves to bar graphs. Let's take a look at an example. I already have the college data set loaded. And let's say that I would like to create a bar graph showing how many institutions have different number of undergraduate students. I could try to do this with a standard bar graph. I'd call GG plot. Specifying that I'd like to use the college data set. And then I'd like to add a bar geometry. Setting the X value for that bar equal to the number of undergraduates. When I run this, the graph that I get is strange looking and surprising. What's actually happened here is there are so many lines on this graph that R isn't even able to render it properly. There are literally over 1,000 lines on this graph and they're so small that you can't see them on this plot. You see a few values represented where there are several lines close to each other. And you can…

Contents