force plot onto next frame without erasing the previous plot (using packages plotrix, bpDir, circular)

50 views Asked by At

I want to plot the following using the bpDir package (that also includes circular and plottrix).

library(bpDir)
require(circular)
require(plotrix)
data(fisherB12c)
CircularBoxplot(fisherB12c, template="geographics")

The above works fine, as it should. Let me now try and get two figures side by side.

par(mfrow = c(1,2))

CircularBoxplot(fisherB12c, template="geographics")
CircularBoxplot(fisherB12c, template="geographics")

The second plot simply wipes out the first plot and puts the second plot in its place, thus not quite what I want. How do I get these to be side-by-side? I tried

par(mfrow = c(1,2))

CircularBoxplot(fisherB12c, template="geographics")
frame()
CircularBoxplot(fisherB12c, template="geographics")

but that wipes out the first plot on the left. What am I doing wrong? Any suggestions on how to get around this problem?

Many thanks!

1

There are 1 answers

2
Allan Cameron On BEST ANSWER

One option is to use patchwork:

library(patchwork)

p <- wrap_elements(full = ~CircularBoxplot(fisherB12c, template="geographics")) 
p + p

enter image description here