Re: [R] using identify() with scatterplot3d()

About this list Date view Thread view Subject view Author view Attachment view

From: Uwe Ligges (ligges@statistik.uni-dortmund.de)
Date: Fri 28 Jun 2002 - 03:59:06 EST


Message-id: <3D1B526A.486DDD22@statistik.uni-dortmund.de>

Tak Wing Chan wrote:
>
> Dear all
>
> I am running R 1.4.1 on a Linux box. I have tried to label data points
> in a 3-d scatterplot, but without much success. What I did was as
> follows:
>
> > scatterplot3d(x, y, z)
> > identify(x, y, z, row.names(Data))
>
> When I tried to click on/near the data points, I either receive this
> msg:
>
> warning: no point with 0.25 inches,
>
> or some numbers in Data, not the row names, come up on the graph. So I
> wonder if I've got something wrong. Is it possible to use identify()
> with scatterplot3d() ?

Yes, but it's tricky. Since scatterplot3d() performs a projection 3D -->
2D and identify() is designed for 2D, we have to use the following
trick:

scatterplot3d() returns invisibly some useful functions to do the
transformation for the generated plot. So let's assign the result into
"s3d":

  s3d <- scatterplot3d(x, y, z)
  # No we can use:
  identify(s3d$xyz.convert(x, y, z), row.names(Data))

For details see the Values section in ?scatterplot3d.

Anyway, if you want to label *all* points, you can use:

  s3d <- scatterplot3d(x, y, z)
  text(s3d$xyz.convert(x, y, z), label = row.names(Data), pos = 4)

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:34 EST