Area Plots
Get introduced to area plots and learn how to generate them.
We'll cover the following...
Feature
Area plots, also referred to as stacked area charts, are a form of data visualization that exhibit the evolution in the distribution of a whole over time. These plots share similarities with line charts but differ in that the space below the line is filled with color or shading to represent the data.
We use area plots to compare the relative proportions of different categories or variables over time. For example, we could use an area plot to show the changing proportions of varying income levels in a population over several years.
Area charts with plot()
We use the polygon()
function to create area charts in base R. We first create an empty chart and then add the layer created using the polygon()
function. To create an empty chart, we use the type = 'n'
argument in the plot()
function.
The polygon()
function takes two containers including a series of numbers. The numbers ...