sigplot icon indicating copy to clipboard operation
sigplot copied to clipboard

Display currently "selected" intensity value with raster plots

Open KevinPoole opened this issue 4 years ago • 6 comments

Hey all,

First, a very cool tool. Appreciate you all making this available.

I am putting this as a feature request but it may really just be a request for slightly more detailed documentation.

All I want to do, is when hovering over a raster plot, to be able to see what the value is of any given pixel I am hovered over (the Z value basically, the intensity). If necessary I could do this in some sort of custom way with event listeners (at least, I think I could. I could do something similar to the mouse events example - https://sigplot.lgsinnovations.com/sigplot-2.0/tryout.html - and try to figure out where I am in the raster grid and then correlate that to the value in the source data) but it just seems like the sort of thing that sigplot must surely support out of the box and I simply can not figure out how. I would expect to be able to see a z (and corresponding dz value) in the bottom left of the plot window, or at least to be able to optionally toggle on such a thing, but again I can not figure out how.

Thanks in advance for any assistance you can offer!

KevinPoole avatar Aug 19 '21 22:08 KevinPoole

@KevinPoole first off, glad that you like SigPlot.

For static (i.e. not streaming) raster plots you can hover over a point and press 'z' on the keyboard and it will show you the intensity value as a pop-up.

There is also an API, but it's not well documented (as you have discovered).

plot.get_layer(layer_id).get_z(real_x_pos, real_y_pos)

For scrolling rasters, it's not as easy because some optimizations have been made to improve performance.

Your idea of having a 'Z' and 'dZ' in the bottom would be a new feature, but I like the idea. I'll see if we can work that into the next release.

PS - the latest SigPlot code can now be found at https://github.com/spectriclabs/sigplot

maihde avatar Aug 20 '21 01:08 maihde

@maihde first, thank you so much for your quick and detailed response.

I just got back to this today and had the chance to try your suggestions. A few observations:

  • I do have a static raster plot, but pressing z does not seem to work
  • I went over to the "Raster (Penny)" example here and found that pressing z did work there, but...
  • upon opening that example at the JSbin so I could attempt to troubleshoot when compared to my example, I found that pressing z in the example jsbin did not work.

I would love to hear any thoughts you might have, and also whether you see the same behavior that I do.

KevinPoole avatar Aug 23 '21 21:08 KevinPoole

The JSbin doesn't work because it appears that the textbox is stealing the keypress inputs for everything (for example the 'm' keypress doesn't work either).

Do you know what version of SigPlot you are using in your test? Are you able to download the latest version of Sigplot from https://github.com/spectriclabs/sigplot and run the unitests?

maihde avatar Aug 25 '21 16:08 maihde

@KevinPoole - due to the fact that you closed this, am I to assume that you have resolved the issue?

maihde avatar Sep 09 '21 11:09 maihde

Hi @maihde - actually, no. Perhaps closing the issue was the wrong approach. Truthfully what happened is that this particular problem fell in priority for me at the moment.

Also, we're using the react-sigplot library from NPM so I was not positive how to take your suggested next steps.

I will reopen the issue - sorry for the confusion.

KevinPoole avatar Sep 09 '21 12:09 KevinPoole

@KevinPoole I think I found the issue. If the minimum z value was zero it would cause the 'show-z' method to not display anything. https://github.com/spectriclabs/sigplot/commit/905903e4b649021d47ca61b44e69ecbcf45835c6

maihde avatar Sep 11 '21 15:09 maihde