gdd_plot: Plot Developmental Rate vs Temperature with the Fitted Model

View source: R/gdd_plot.R

gdd_plotR Documentation

Plot Developmental Rate vs Temperature with the Fitted Model

Description

Draws a scatter plot of the developmental rate against temperature with the fitted model. For the linear model the threshold temperature C is marked where the fitted line crosses V = 0; for nonlinear models the fitted curve is drawn and C / Topt / the upper threshold are marked where defined.

Usage

gdd_plot(
  x,
  group = NULL,
  show_C = TRUE,
  show_Topt = TRUE,
  title = NULL,
  sub = NULL,
  family = "serif",
  xlab = "Temperature T (deg C)",
  ylab = "Developmental rate V (1/d)",
  ...
)

Arguments

x

A "gdd" object returned by [gdd_calc()].

group

Character vector of group names to plot; default is all groups.

show_C

Logical; whether to mark the threshold temperature C. Default TRUE.

show_Topt

Logical; whether to mark the optimum temperature (nonlinear models only). Default TRUE.

title

Plot title. NULL (default) uses the automatic per-group caption (group name + C / K / R-squared for the linear model, group name + model label + R-squared / AIC for nonlinear models). A single character string is used for every plotted group; a named character vector is matched by group name (e.g. c(Egg = "egg", Pupa = "pupa")); use "" to drop the title. When a custom title is given, the automatic statistics caption is moved to the sub line unless sub is also supplied.

sub

Plot subtitle (bottom line). NULL = the automatic statistics caption when title is customised, otherwise none.

family

Text font family used for the title, axis labels and tick labels. Default "serif" — a portable alias that maps to Times New Roman on 'Windows' (the journal standard) and to the system serif font elsewhere, and is valid on every device (including pdf()). Latin characters are rendered with this font; Chinese characters are rendered through the device's font fallback, which on Chinese 'Windows' is SimSun, so mixed English-Chinese titles work without extra settings. Set to "" to use the device default, or pass an explicit family such as "Times New Roman" (widely available on 'Windows'; may be unknown to the pdf() device on other platforms).

xlab, ylab

Axis labels.

...

Further graphical parameters passed to plot.

Examples

f <- system.file("extdata", "gdd_example.csv", package = "insectecol")
fit <- gdd_calc(gdd_read(f), by = "stage")
gdd_plot(fit, group = "Egg")

## Custom title, subtitle and axis labels (portable English example):
gdd_plot(fit, group = "Egg",
         title = "Developmental rate vs temperature",
         sub = "Constant-temperature rearing experiment, 2026")

## Chinese titles are rendered through the device's font fallback
## (SimSun on Chinese 'Windows'); note that the plain pdf() device
## cannot embed CJK glyphs on many platforms, so draw on a png or
## cairo device for Chinese titles.

insectecol documentation built on Oct. 5, 2026, 5:08 p.m.