Just dev.off!

I was playing with RStudio recently. And there was this annoying “issue” with plots. I am calling it “issue” as I am not quite sure whether this is a bug or a feature.

The problem was that plots were drawn outside plot area. Axises were missing, title was too high, etc.

I was trying to change plot margins, to squeeze the plot inside plotting area, change the font size, and nothing really worked.

What solved the problem was this tiny line of code

dev.off()

That’s it. All you have to do is to call dev.off(). And then, plot again.