So I'm having a bit of trouble getting rid of the entire margin of a graphics device. I've set mar to 0, but there is still some persistent space around the edge. For example:
plot.new()
par(mar=c(0,0,0,0))
plot.window(c(0,1),c(0,1))
points(c(1,1,0,0),c(1,0,1,0))
I would like the points to be centered at the extreme edges of the plot. Is there a par
that I am missing?
This is controlled by the arguments to ?par xaxs
and yaxs
. These are passed on by the ... argument of plot.window and other plot functions.
plot.window(c(0,1),c(0,1), xaxs = "i", yaxs = "i")
From the help page for ?par, the default setting "r" extends the data range by 4 percent, and "i" uses the data range exactly:
Style ‘"r"’ (regular) first extends the data range by 4 percent at each end and then finds an axis with pretty labels that fits within the extended range. Style ‘"i"’ (internal) just finds an axis with pretty labels that fits within the original data range.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With