[R] ggplot2: multiple box plots, different tibbles/dataframes

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Nov 11 14:50:26 CET 2021


On Wed, 10 Nov 2021, Avi Gross via R-help wrote:

> I think many here may not quite have enough info to help you.

Avi,

Actually, you've reflected my thinking.

> But the subject of multiple plots has come up. There are a slew of ways,
> especially in the ggplot paradigm, to make multiple smaller plots into a
> larger display showing them in some number of rows and columns, or other
> ways. Some methods use facet_wrap() or facet_grid() type functionality that
> let you plot multiple subdivisions of the data independently. These though
> generally have to be in some way related.

My experience with facets (which I belive are like latice's conditioned
trellis plots has each plot in a separate frame in a row, column, or
matrix.) That won't communicate what I want viewers to see as well as would
having all in a single frame.

My data represent hydrologic and geochemical conditions at four locations
along the mainstem of a river. While the period of record for each
monitoring gauge is different, I want to illustrate how highly variable
conditions are at each location. The major factor of interest is discharge,
the volume of water passing a river cross section at the gauge location in
cubic feet per second. I have created boxplots for each site representing
the distribution of discharge for the entire data set and I'd like to place
each of the four horizontal boxplots stacked vertically with the
southern-most at the bottom and the northern-most at the top (the river
flows north).

> Yet others let you make many independent graphs and save them and later
> recombine them in packages like cowplot.

I discovered cowplot yesterday but haven't yet read the PDF or vignette.

> So, although it may also be possible to do whatever it is you want within a
> single plot, it may also make sense to do it as loosely described above.

While I certainly may be wrong, I believe that seeing all four boxplots in
the same frame makes the differences in distribution most clear.

Thanks,

Rich



More information about the R-help mailing list