epezent / implot

Immediate Mode Plotting
MIT License
4.81k stars 531 forks source link

Emission spectrum plot and alike #564

Open noncom opened 7 months ago

noncom commented 7 months ago

I'm looking into creating some emission spectra analysis software, and am looking into a way of displaying such spectra built from data.

As an example, take a look at the cells 15-17 in https://learn.astropy.org/tutorials/2-WavelengthCalibration.html, like:

2-WavelengthCalibration ipynb_25_0

Usually these images are used as-is in their image form, but I need to have an opportunity to plot them with just the intensity data array for every x. Because in my case I need to be able to dynamically change the brightness of the lines.

The question is: is that possible to achieve with implot currently? Or if not -- would it be possible to add this kind of plot?

From exploring the available options I found some that kinda get closer to what I need, but not quite:

Currently I don't think it's easily possible to achieve what I need. Maybe it could be possible through some combination of overlayed plots, or a creative use of the existing features. I would really appreciate an advise here. Or it might be better to create a dedicated plot type for this kind of data display, basically which plots a dynamically changing intensity array on a color spectrum (map/palette).

Also I understand that it's probably much much easier to achieve this with a fragment shader, together with the image-showing capability of implot. I think I can perfectly use this way, since I'm working in Unity, and it has everything I need for that, but shaders come with their own restrictions and complications, so I would really like to know if the vertex-based implot version is a viable idea.

phkehl commented 7 months ago

Maybe you can use the heat map plot, with 1 value (the spectral intensity) in y, and stretch the plot in y, so that you get long and thin lines?