You can't use any of the classic ways due to the way the scatterplot3d()
function constructs the plot. It's basically plotted on top of a classic plot pane, which means the axis labels are bound to the classic positions. The z-label is printed at the real left Y-axis, and the y label is printed at the real right Y-axis.
You can use text()
to get around this:
- use
par("usr")
to get the limits of the X and Y coordinates - calculate the position you want the label on (at 90% of the horizontal position and 8% of the vertical position for example.)
- use
text()
to place it (and possibly the parametersrt
to turn the label)
This makes it a bit more generic, so you don't have try different values for every new plot you make.
Example :
scatterplot3d(A,D,B, xlab=expression(paste(x[a],"-",x[b])),
ylab="",
zlab=expression(sigma^2))
dims <- par("usr")
x <- dims[1]+ 0.9*diff(dims[1:2])
y <- dims[3]+ 0.08*diff(dims[3:4])
text(x,y,expression(x[a]),srt=45)
Gives