if (FALSE) {
library(agridat)
data(petersen.wheat)
dat <- petersen.wheat
libs(desplot)
# True layout: single line of 48 plots
# For visualization, rearrange into a grid (8 rows x 6 columns)
dat <- transform(dat,
row = (plot - 1) %% 8 + 1,
col = (plot - 1) %/% 8 + 1
)
# Custom colors: green shades for 30 new selections, orange shades for 3 checks
checks <- c("Ci", "St", "Wa")
new_gens <- sort(setdiff(levels(dat$gen), checks))
col_checks <- colorRampPalette(c("darkorange", "orange", "goldenrod"))(3)
col_new <- colorRampPalette(c("darkgreen", "forestgreen", "limegreen"))(30)
names(col_checks) <- checks
names(col_new) <- new_gens
gen_cols <- c(col_checks, col_new)
desplot(dat, gen ~ col*row,
col.regions = gen_cols,
out1 = block,
text = gen, shorten = "no", cex = 0.7,
show.key = FALSE,
flip = TRUE,
main = "petersen.wheat - rearranged as grid"
)
}
Run the code above in your browser using DataLab