问题
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?
回答1:
The following does it. Call after that recordedPlot
boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
recordedPlot = recordPlot()
dev.off()
来源:https://stackoverflow.com/questions/27064296/how-to-save-boxplot-to-as-to-a-variable