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

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Thu Nov 11 18:22:07 CET 2021

On Thu, 11 Nov 2021, Avi Gross wrote:

> Boxplots like many other things in ggplot can be grouped in various ways.
> I often do something like this:


I've designed and used multiple boxplots in many projects. They might show
geochemical concentrations at two locations or in two (or three) separate
time periods. All data in a single dataframe.

> To display multiple boxplots subdivided by place is as easy as using the
> phrase in an aes() clause like:
> 	ggplot(your_data, aes(..., color=PLACE)) + geom_boxplot()

What I need to plot are multiple 'your_data' sets. I'll be testing this:
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

today, but using four boxplots.



More information about the R-help mailing list