A previous post described the new function catalog. Here are a few updates on catalog based on suggestions from warbleR users.
To be able to run the code you need warbleR 1.1.9 or higher, which hasn’t been released on CRAN and it’s only available in the most recent development version on github. It can be installed using the devtools package as follows
And load the package and save the example sound files as .wav in the working directory
1) Arguments “spec.mar”, “lab.mar”, “max.group.colors” and “group.tag” to color background of selection groups
The following code creates a catalog with 3 columns and 3 rows labeled with the sound file name and selection number (default labels argument)
The new arguments can be used to add a background color that is shared by selections belonging to the same grouping variable level. The following code uses the “sound.files” column to color selection groups using “group.tag”. It also makes use of the “spec.mar” to increase the colored areas around the spectrograms and “lab.mar” to shrink the area allocated for selection labels and tags
Note that the selection tables are sorted to ensure that selection sharing the same grouping factor level are clumped together in the catalog.
In the example some sound files are highlighted with very similar colors, which makes the visual identification of groups difficult. Using a different palette might solve the problem. Alternatively, the “max.group.cols” argument can be used to set a maximum number of different colors (independent of the levels of the grouping variable) that will be recycled when the number of colors is smaller than the number of levels. This works as follows
2) Arguments “title”, “by.row”, “prop.mar”, “box” and “rm.axes” to further customize catalog setup
As their names suggest, the arguments “title” and “rm.axes” allow users to add a title at the top of catalogs and remove the x and y axes. respectively:
The argument “by.row” allows to fill catalogs either by rows (if TRUE) or by columns (if FALSE).
The argument “box” allows users to draw a rectangle around the spectrogram and corresponding labels and tags
Finally, the argument “prop.mar” allows to add margins at both sides of the signals (when creating the spectrogram) that is proportional to the duration of the signal. For instance a value of 0.1 in a signal of 1s will add 0.1 s at the beginning and end of the signal. This can be particularly useful when the duration of signals varies a lot. In this example a margin equals to a third of signal duration is used: