Emission spectrum plot and alike
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:
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:
- The
ColormapScale()plot is very close, but:- Hardcoded to only be vertical
- Has no option to set intensity of the particular lines
- The
RenderColorBar()function that is used as the basis ofColormapScale()andColormapButton()looks good, but:- Is not exposed by the ImPlot.NET bindings that I'm using, and I don't know why. Is there any inherent reason why this function might be hidden, or is it just some peculiar bindings issue and I could just bind and use it?
- Has no option to set intensity of the particular lines
- The
PlotBarGroups()plot could be used as well, but:- Relies on the Colormap, which seems to be not-so-immediate among all the features as I don't believe that it relies on a not-so-immediate colormap which can't be changed in runtime (see the requirement of changing the brightness of the lines dynamically).
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.
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?