Intermediate Data Visualization With ggplot2
Dive deeper into ggplot2 and learn how to make a variety of different types of visualizations
StartKey Concepts
Review core concepts you need to learn to master this subject
Histograms In R
Boxplots In R
The Fill Argument
The stat Parameter
The Position Argument
Error Bars In R
Customizing Discrete Axes In R
Customizing Continuous Axes In R
Histograms In R
Histograms In R
# Creates a histogram of the Ozone feature from the dataset airquality. In this case, each bin will have a width of 10.
airquality_histogram_binwidth <-
ggplot(airquality, aes(x = Ozone)) +
geom_histogram(binwidth = 10)
In R, the geom_histogram()
function from the ggplot2
library will create a histogram. The binwidth
argument sets the width of the bins in the histogram.
If the binwidth
argument is not used, the histogram will create 30 bins by default of equal size. It is recommended to use the binwidth
argument to make the histogram smoother.
Histograms are used to visualize the distribution of a continuous variable.
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory