Description Usage Arguments Details Value Author(s) Examples
This function draws axis labels for a 3d plot generated by graphics::persp
1 2 | axLabels3d(xlab = "x", ylab = "y", zlab = "z", cex = 2, pmat,
dist = c(1.4, 1.3, 1.4), x, y, z)
|
xlab |
String - X axis annotation. Defaults to "x". |
ylab |
String - Y axis annotation. Defaults to "y". |
zlab |
String - Z axis annotation. Defaults to "z". |
cex |
double - character magnification. Defaults to 2. |
pmat |
matrix of type double - A 4x4 matrix returned by calling graphics::persp |
dist |
vector of type double - A three-dimensional vector containing the distances in (x,y,z)-direction between axis and annotation. Defaults to c(1.4,1.3,1.4). |
x |
vector of type double - The x range. It suffices, to supply c(min(x),max(x)) |
y |
vector of type double - The y range. It suffices, to supply c(min(y),max(y)) |
z |
vector of type double - The z range. It suffices, to supply c(min(z),max(z)) |
This function is especially designed for persp plots, since these lack manipulation options for individual axis annotation texts. Please supply empty axis labels to persp, i.e. persp(xlab = "",ylab = "",zlab="",...).
No return value
Philipp van Wickevoort Crommelin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | x = seq(from = -10,
to = 10,
length.out = 30)
y = x
f = function(x,y) {
r =sqrt(x^2+y^2)
10 * sin(r)/r
}
z = outer(x, y, f)
z[is.na(z)] = 1
par(mfrow=c(2, 1))
p1 = persp(x = x,
y = y,
z = z,
theta = 30,
phi = 30,
expand = 0.5,
col = "lightblue",
ticktype="detailed",
xlab="",
ylab="",
zlab="",
r = 10)
myBayes::axLabels3d(x = x,
y = y,
z = c(min(z),max(z)),
pmat = p1,
xlab = "x label",
ylab = "y label",
zlab = "z label")
p1 = persp(x = x,
y = y,
z = z,
theta = 30,
phi = 30,
expand = 0.5,
col = "lightblue",
ticktype="detailed",
xlab="",
ylab="",
zlab="",
r = 10)
myBayes::axLabels3d(x = x,
y = y,
z = c(min(z),max(z)),
pmat = p1,
dist = c(1.6,1.5,1.6),
xlab = "x label",
zlab = "z label")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.