[R] Arrow and text on a 3d plot
Arturo T. De Zan
arturodezan at gmail.com
Thu Dec 2 12:14:15 CET 2004
I am currently working on surface plots (with R 2.0.1) and I want to
improve the aspect of them. Having a typical 'cow-boy hat' surface
[source: Spector (1994), p. 206]:
pts <- seq(from = -8, to = 8, length = 50)
cow <- function(x, y)
z <- sqrt(x^2+y^2)
out <- outer(pts, pts, cow)
sur <- persp(x=pts, y=pts, z=out, theta=45, phi=30)
What I exactly wanted is:
a) how to add an arrow pointing the maximum point in the surface, for
example: a short arrow starting on the maximum point, with slope 45Âº
and finishing near the top-edge of the plot.
b) how to add a typical text at the end of the arrow, as "this is the
maximum point", as described in the above reference.
N.B.: the author used the S function "perspp", but R does not have it.
Could anyone help me?
Thank you very much in advance.
Arturo De Zan
UPC-Universitat Politecnica de Catalunya
More information about the R-help