On Wed, May 26, 2010 at 8:53 PM, Kim Jung Hwa wrote:> I'm using 'tck' option to *reduce* the length of tick marks but
it is not
> working, can anyone please tell me where I'm going wrong...
>
> require(graphics)
> require(grDevices)
> x <- seq(-10, 10, length= 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
>
> # 'bg' works but 'tck' is not showing any effect...
> par(bg="gray90", tck=0.01)
> persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col =
"lightblue",
> ltheta = 120, shade = 0.75, ticktype = "detailed",
> xlab = "X", ylab = "Y", zlab = "Sinc( r )"
> ) -> res
If you look in the C code that gets called by persp() (part of the
internal R code: /src/main/plot3d.c) you'll find:
static void PerspAxis(double *x, double *y, double *z,
int axis, int axisType, int nTicks, int tickType,
const char *label, cetype_t enc, pGEDevDesc dd)
{
Vector3d u1, u2, u3, v1, v2, v3;
double tickLength = .03; /* proportion of axis length */
...
So, it looks like the tick length is hard coded as 3% of the axis
length. I suppose you could edit that and re-compile R from source,
but maybe there's an easier way? Perhaps I'm mistaken?
Sean