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

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


On Thu, 11 Nov 2021, Avi Gross via R-help wrote:

> This is not a place designed for using packages but since this discussion
> persists, ...

Avi,

I'll find a cowplot help site.

> # Create and save two ggplots, or more in your case:
>
> p1 <- ggplot(data=df1, aes(x=NULL, y=cfs)) +
>  geom_boxplot(color="red", fill="yellow")
>
> p2 <- ggplot(data=df2, aes(x=NULL, y=cfs)) +
>  geom_boxplot(color="green", fill="pink")
>
> # combine the two or more verically using the plot_grid() from cowplot
> plot_grid(p1, p2, ncol=1)

The data were already read in. Now I need to learn more of cowplot's
plot_grid to put the site name on the x-axis, turn the boxplots horizontal,
and change the plot box so it's not as wide as the default.

Thanks very much,

Rich



More information about the R-help mailing list