Set up

library(pmplots)
library(dplyr)

data <- pmplots_data_obs()

A default plot

dv_pred(data)
## `geom_smooth()` using formula 'y ~ x'

Customize the axis label

dv_ipred(data) + labs(x = "Predicted concentration (mg/L)")
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'

Add Greek symbols to an axis label

There are a couple of ways to do this. The easiest is to have the latex2exp package installed and write the TeX right in the label.

dv_pred(data, x = "IPRED//Predicted concentration ($\\mu$g/mL)")
## Loading required namespace: latex2exp
## `geom_smooth()` using formula 'y ~ x'

Otherwise, you can trigger R plotmath by putting !! at the start of the column label

dv_pred(data, x = "IPRED//!!'Predicted concentration (' * mu * 'g/mL)'")
## `geom_smooth()` using formula 'y ~ x'

Add a run number or other annotation to the plot

dv_pred(data) + labs(subtitle = "Run 1001")
## `geom_smooth()` using formula 'y ~ x'

Adopt the pmplots look and feel

At some point, you might have to create a plot outside of pmplots, but you still want to adopt the pmplots look and feel.

p <- ggplot(data = data, aes(PRED,DV)) + geom_point()
p

Use these helpers to style the plot

## `geom_smooth()` using formula 'y ~ x'