Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save boxplot to as to a variable?

Tags:

r

boxplot

How can I save the box plot as a variable in R? For example, if I did like this,

plot <- boxplot(count ~ spray, data = InsectSprays, col = "lightgray")

when I call plot, I want it shows the box plot, that I don't need to run the command for plotting boxplot every time.

Does anyone have any idea?

like image 848
Jie Avatar asked Nov 21 '14 15:11

Jie


Video Answer


1 Answers

The following does it. Call after that recordedPlot

boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
recordedPlot = recordPlot()
dev.off()
like image 76
Ruthger Righart Avatar answered Sep 30 '22 19:09

Ruthger Righart