Plotting with ggplot2 in R
ggplot2 is a popular package in R for creating data visualizations. It is built on the idea of creating plots by layering different components, such as data, aesthetic mappings, and geometric objects. Here’s an example of how to create a scatter plot in ggplot2: {r} # Load ggplot2 package library(ggplot2) # Generate some data x