Layout and visualization of experimental design

Functional approach to creating and combing multiple plots

This approach highlights features of gridExtra package that allows combining multiple grob plots using function calls. We explicitly use lapply/split or similar class of purrr functions to really scale the graphics.

We load a Hybrid maize trial dataset, with fieldbook generated using agricolae::design.rcbd(). The dataset looks as shown in Table 1, after type conversion and cleaning.

Table 1: Intermediate maturing hybrids with 50 entries each in 3 replicated blocks
RepBlockPlotEntrycolrowtilleringmoisture1moisture2Ear countPlant height
1111113.03.535270
1123123.03.525266
11318133.54.030261
11432144.04.526224
11537154.04.530268
12627164.04.520268
12721174.04.525277
12813183.54.025264

For the given dataset, we can draw on the information that Rep variable was used as field level blocking factor (Although separate, Block, variable exists, it was nested inside the Rep.) Therefore, to begin with, we ignore other spatial grouping variable. Now, since the grid graphics only requires two way represenation of plotting data, we have row and col information feeding for that.

Plotting call

Lattice graphics approach

Using built-in function desplot() in desplot package, we can generate similar field design layout. In the plot below, individual entries (a factor variable) are highlighted as cell features. The process follows as shown below. In addition to default plotting, we can also generate serpentine design layout using simple mutating trick. Plus, block grouping has also been added to show the nested factor component.

Note: In order to plot in required layout, just specify: layout = c(number_of_rows, number_of_columns) argument (Thanks to Kevin Wright for helping me figure this out.)

comments powered by Disqus

Related