Visualization
Create plots with ggplot2 — scatter, line, bar, and box plots.
All plots in this course use theme_classic() and labelled axes via labs(). Run the setup chunk first — it loads ggplot2 and creates the datasets.
Scatter plot
Use geom_point() to plot individual observations — ideal for calibration curves.
Add a regression line with geom_smooth():
Line plot
Use geom_line() for data over time — ideal for dissolution profiles. Map colour to a grouping variable to show multiple batches.
Box plot
Use geom_boxplot() to compare distributions across groups — ideal for batch comparisons.
Bar chart
Use geom_col() when you already have the values to plot (e.g. means from summarise()).
Every plot starts with ggplot(data, aes(...)) — this sets the data and axes. Add layers with +: geom_point(), geom_line(), labs(), theme_classic(). Order doesn’t matter for most layers, but theme_classic() always goes last.