Reputation: 2170
I designated the width, height, and resolution of the plot, then removed the margins as in the below code, and drew a plot.
But I still have margins. I got the same plot with and without the par
command. The uploaded image was reduced from 7000*5000 to 1400*1000 to reduce under 2MB.
library(scatterplot3d)
parwd = 7000
parht = 5000
parres = 1000
par(oma = c(0,0,0,0), mar = c(0,0,0,0))
jpeg(filename="CC_1_fo.jpg", width = parwd, height = parht, res = parres)
scatterplot3d(1:10, 1:10, 1:10,
cex.symbol = 0.2,
xlab = expression(T[1]),
ylab = expression(T[2]),
zlab = expression(tau))
dev.off()
How can I really remove the margins?
Upvotes: 4
Views: 253
Reputation: 35187
I guess 3D plotting is a bit funky and some of the par
arguments don't work as expected. Specifically, if you want to set margins with mar
you have to use the actual mar
argument in scatterplot3d
.
This is stated in the notes of the help (?scatterplot3d
):
Some graphical parameters should only be set as arguments in
scatterplot3d
but not in a previouspar()
call. One of these ismar
(...)
Using:
scatterplot3d(1:10, 1:10, 1:10,
cex.symbol = 0.2,
xlab = expression(T[1]),
ylab = expression(T[2]),
zlab = expression(tau),
mar = c(0,0,0,0))
will result in a plot without margins:
Setting the margins to zero will cut off your tick-labels though.
Upvotes: 6