Christoph Lehmann
2003-Sep-30 08:16 UTC
[R] using identify() together with plot () and pixmap()
Dear R users I have a two-dimensional array, whose values I want to plot, using the pixmapGrey class. Plotting works fine, and now I would like to be able to identify some of the points in the plot using identify(). But I get the following message while pressing the left mouse button:> plot(pixmapGrey(fmri.vtc[,,slice,volume])) > identify(fmri.vtc[,,slice,volume])warning: no point with 0.25 inches pressing the right mouse button I get: numeric(0) what is the problem here and how can I solve it? many thanks for your help Cheers! Christoph -- Christoph Lehmann <christoph.lehmann at gmx.ch>
Barry Rowlingson
2003-Sep-30 08:38 UTC
[R] using identify() together with plot () and pixmap()
Christoph Lehmann wrote:>>plot(pixmapGrey(fmri.vtc[,,slice,volume])) >>identify(fmri.vtc[,,slice,volume]) > > warning: no point with 0.25 inches > > > pressing the right mouse button I get: > numeric(0) > > what is the problem here and how can I solve it?The problem is that there is no method for identifying points on a pixmap (and anyway, you are feeding identify() a matrix). You'll need to write an "identify.pixmapGrey" function. This would do something like use the 'locator()' function to get clicks on the screen, and then it would compute which grid cell the coordinates of those clicks were in. pixmap objects store enough information for you to work this out from the attributes - look at the 'bbox' attribute for example. It would make a nice addition to the pixmap library. Although one thing that just suprised me was that the different flavours of pixmap - pixmapGrey, pixmapIndexed, pixmapRGB - dont all inherit from a 'pixmap' class, which might make it easier to write a single identify function for all the types. Baz
Friedrich.Leisch@ci.tuwien.ac.at
2003-Sep-30 09:07 UTC
[R] using identify() together with plot () and pixmap()
>>>>> On Tue, 30 Sep 2003 10:16:11 +0200, >>>>> Christoph Lehmann (CL) wrote:> Dear R users > I have a two-dimensional array, whose values I want to plot, using the > pixmapGrey class. Plotting works fine, and now I would like to be able > to identify some of the points in the plot using identify(). But I get > the following message while pressing the left mouse button: >> plot(pixmapGrey(fmri.vtc[,,slice,volume])) >> identify(fmri.vtc[,,slice,volume]) > warning: no point with 0.25 inches identify() needs x and y values, you are passing it the z values of the image. Maybe you want to use locator()? .f