Home > Mobile >  How to create boxplot from boxplot list in R
How to create boxplot from boxplot list in R

Time:12-09

Suppose, I do not have my original vector v from which to plot boxplot(v)but only the boxplot list object l as from l <- boxplot(v). How do I recreate the boxplot plot from l? boxplot(l)obviously does not work and I also don't want to rebuild a boxplot from scratch in ggplot.

Thank you for your help!

Example

set.seed(3)
v <- rchisq(1:100000,df = 10)
boxplot(v)
l <- boxplot(v)
str(l)
boxplot(l) #Error in x[floor(d)]   x[ceiling(d)] : non-numeric argument to binary operator

CodePudding user response:

Check out this answer from an older post. In the comments, they point out the bxp function.

set.seed(3)
v <- rchisq(1:100000,df = 10)
boxplot(v)
l <- boxplot(v)
dev.off()
bxp(l)

Also, don't knock ggplot! It is the way.

CodePudding user response:

set.seed(3)
v <- rchisq(1:100000,df = 10)

boxplot(v)
l <- recordPlot()
replayPlot(l)
  • Related