| plot_day | R Documentation |
Draws a two-panel plot per day. The upper panel shows the CGM trace over a shaded target range, with the SMBG measurements as diamonds; the lower panel shows the basal rate as a filled step area, the boluses as labelled circles and the carbohydrates as labelled boxes, headed by the insulin delivered over the whole day. Both panels share a 0-24 h axis of the local (wall-clock) time, and a legend is drawn underneath them.
plot_day(
data,
id = NULL,
days = NULL,
target = NULL,
ylim_cgm = NULL,
min_bolus = 0,
units = "mg/dl",
main = NULL
)
data |
A list with all data found for one individual (the output of
|
id |
Character or numeric participant identifier, naming the individual
to plot. Can be omitted if |
days |
The day(s) to plot, as a |
target |
Numeric vector of length two with the glucose target range, drawn as a shaded band. |
ylim_cgm |
Numeric vector of length two with the limits of the glucose axis. |
min_bolus |
Numeric, the smallest bolus that is drawn in full, in units.
Small correction boluses crowd the panel without adding much, and
|
units |
Character string, the units of the glucose data, either
|
main |
Character string with the plot title. Defaults to the id and the day. Note that the same title is used for every day if several are plotted. |
The daily totals are taken from total_basal and total_bolus
where the export provides them, and are summed over the day otherwise. They
therefore cover insulin that the drawn data may not, such as the basal
delivered in automated mode by an Omnipod, and they are unaffected by
min_bolus. A total that is not recorded at all is shown as "-".
Where min_bolus leaves boluses out of the labelled circles, a note next
to the totals says so.
No return value, called for side effects: one plot is drawn per day.
path <- system.file("extdata", "glooko_example.zip", package = "aidR")
data <- parse_data(id = "1", paths = path)
plot_day(data, days = "2026-06-22")
# Custom target range, with boluses below 1 U drawn as ticks only
plot_day(data, days = "2026-06-22", target = c(70, 140), min_bolus = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.