Plot standard fieldbook sketches for regular experimental designs generated in Tarpuy, including completely randomized designs (CRD/DCA) and randomized complete block designs (RCBD/DBCA).
plot_standard_design(
data,
factor = NA,
fill = "plots",
xlab = NULL,
ylab = NULL,
glab = NULL,
text_size = NULL,
wrap_width = NULL,
font_family = "Open Sans",
font_face = "plain"
)A ggplot object.
A fieldbook data frame. It must contain at least rows and
cols.
Character scalar. Name of the column used to color the
experimental units. If missing, "block" is used when available;
otherwise, the third column of data is used.
Character vector. Names of one or more columns used as labels
inside each experimental unit. When ntreat is used, it is displayed as
T1, T2, etc.
Character scalar. Title for the x axis. If NULL, "Columns"
is used.
Character scalar. Title for the y axis. If NULL, "Blocks" is
shown for RCBD/DBCA only when each physical row corresponds to exactly one
block; otherwise "Rows" is used. The plotting coordinate always remains
the physical rows column.
Character scalar. Legend title. If NULL, factor is used.
Optional positive numeric scalar indicating the plot-label
font size in typographic points (pt). If NULL or NA, a suitable
default is selected according to the number of label columns. The value is
converted internally to the unit expected by ggplot2::geom_text().
Optional positive integer indicating the approximate
maximum number of characters per line. If NULL or NA, the function
calculates it automatically from the field dimensions, font size and
number of label columns. Underscores are shown as spaces only in the
plotted label; the original fieldbook values are not modified.
Character scalar. Font family used by the sketch.
Defaults to "Open Sans". If the font cannot be verified through the
optional systemfonts package, "sans" is used as a fallback.
Character scalar. Font face used in labels, axes and
legends. Defaults to "plain".
The function does not calculate or rearrange an experimental design. It uses
the existing rows and cols coordinates from the fieldbook, so the
physical layout and the zigzag order generated by Tarpuy are preserved.
All standard designs are plotted with cols on the x axis and rows on
the y axis. A DBCA/RCBD is therefore displayed according to its actual
physical coordinates rather than replacing the row coordinate with the
block number. When rows and blocks have a strict one-to-one relationship,
only the visible y-axis title changes to "Blocks". The block can still be
selected as the color factor.
Automatic wrapping affects only the sketch. It does not change entry,
ntreat, QR codes, factor levels or any other fieldbook value.
if (FALSE) {
plot_standard_design(
data = fieldbook,
factor = "geno",
fill = c("plots", "entry"),
text_size = 9,
font_family = "Open Sans",
font_face = "plain"
)
}
Run the code above in your browser using DataLab