Basic Area Line Plot
R
# Create synthetic data set.seed (123) df <- data.frame ( Year = 2000:2020, Value = cumsum ( rnorm (21)) ) # Create a basic area line plot ggplot (df, aes (x = Year, y = Value, fill = "Area" )) + geom_area () + labs ( title = "Basic Area Line Plot" , x = "Year" , y = "Cumulative Value" ) + theme_minimal () |
Output:
In this example, we create a basic area line plot using the geom_area() function. We map the Year variable to the x-axis (x) and the Value variable to the y-axis (y). The fill aesthetic is set to “Area” to specify the fill color of the area below the line. We also add a title and axis labels using the labs() function.
Area Line Plot in R
Area line plots, commonly referred to as filled area plots, are effective data visualisation techniques in R for showing how data evolves over time. They are particularly helpful for displaying trends, distributions, and time series data. In this article, we’ll look at how to use the well-liked ggplot2 programme to generate area line plots in R.