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

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


On Wed, 10 Nov 2021, Rich Shepard wrote:

> I have the code to create ggplot2 boxplots using two attributes (e.g.,
> chemical concentration and month) from the same tibble. Is there an
> example from which I can learn how to make boxplots from different
> tibbles/dataframes (e.g., chemical concentrations and monitoring
> location)?

I think that I've found the solution (haven't yet tested it, though):
<https://statisticsglobe.com/combine-two-ggplot2-plots-from-different-data-frames-in-r>.

It's from Statistical Globe and uses this code:
ggp <- ggplot(NULL, aes(x, y)) +    # Draw ggplot2 plot based on two data frames
   geom_point(data = data1, col = "red") +
   geom_line(data = data2, col = "blue")
ggp                                 # Draw plot

More when I try it with four boxplots.

Rich



More information about the R-help mailing list