Skip to contents

Plot individually the outcome measurement for each individual unit in the experiment (ID). Use the wrap_on to select the ID column that identifies each unique individual.

Usage

plot_outcome_by_id(
  df,
  x,
  y,
  color,
  wrap_on,
  ncol = 5,
  xlab = "Days after treatment",
  ylab = expression("log"[10] * "(Total flux (photons/sec))"),
  legend_lab = "Treatment",
  title = "",
  base_size = 10
)

Arguments

df

Dataframe containing all the measures. It should be in the long format. See tidyr::pivot_longer to see how to get data in the long format and the Vignette `Formatting the data`.

x

Column that has the time axis

y

Column that has the outcome measurement

color

Column to be used when plotting the dots and curves.

wrap_on

Column identifying the IDs of the samples.

ncol

Number of columns to use to organize the plots. Default is 5.

xlab

Name of xlab. Default is "Days after treatment"

ylab

Name of ylab. Default is expression("log"[10]*"(Total flux (photons/sec))")

legend_lab

Legend's name. Default is Treatment.

title

Title for the plot. Default is no title.

base_size

integer specifying the base_size for ggplot2::theme_bw. Default is 10. Change this according to your screen size and needs.

Value

A ggplot2 object

Examples

plot_outcome_by_id(
    t110_ivis_long,
    x = "days_after_treatment",
    y = "log10tf",
    color = "treatment",
    wrap_on = "id"
)
#> Warning: Removed 2 rows containing non-finite outside the scale range (`stat_smooth()`).
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`).