Overlay plot on top of another

61 views Asked by At

This question leads off from this one:

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

I have the following plot using patchwork in R:


library(circular)
data(fisherB12c)
library(bpDir)
library(patchwork)

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

gives me the plot side-by-side.

However, I am wondering if there is a way to overlay the second plot on top of the first plot. I don't know if patchwork can do this.

Sorry, if I am not clear: I am looking for one plot, with the distribution (on the right, same in this case) diplayed on the same figure, but at a different radius (per shrink) as the first one.

1

There are 1 answers

0
user3236841 On BEST ANSWER

I found an answer from overlaying a plot without axis title in R (without ggplot2) without using patchwork.

library(circular)
data(fisherB12c)
library(bpDir)
CircularBoxplot(fisherB12c, template="geographics", shrink = 1.5) 
par(new = T)
CircularBoxplot(fisherB12c, template="geographics", shrink = 2) 

This gives me:

enter image description here

Perhaps there is a better answer than this kludge. Of course, a better way to do this would be to modify the rather inflexible CircularBoxplot function. But for a quick display, this is an option.