creat two or more plots in one background using ggplot2

How can i creat tow or more plots in one background? I used code: par(mfrow = c(1,2)) can realized it before. but i saw it doesn't work while i using ggplot2. Is there any other way to help me ? i kown some packages that can help me to put the plots together, but i am thinking is there any way to realized it like par(mfrow = c(1,2)) and needn't i write one more code to splice them.

it's two not tow sry~

par() is a function that is used in laying out base R plots.
ggplot2 plots are not base R plots and so you will need something else.
There are many tools in this space, I can think of 3 and there are likely more.
you could look into :
perhaps look them up on cran and compare their vignettes / intros and see which one appeals to you most.

1 Like

We probably need your code and some sample data. I am not really sure what you mean by two or more plots in one background. Have a look at
FAQ: How to do a minimal reproducible example ( reprex ) for beginners

Depending on what you are doing you may wast to have a look at ggplot2's .facet_wrap or facet_grid options. As @ nirgrahamuk says you probably need another package.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.