Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emission spectrum plot and alike #564

Open
noncom opened this issue Apr 12, 2024 · 1 comment
Open

Emission spectrum plot and alike #564

noncom opened this issue Apr 12, 2024 · 1 comment

Comments

@noncom
Copy link

noncom commented Apr 12, 2024

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:

  • 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 of ColormapScale() and ColormapButton() 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.

@phkehl
Copy link
Contributor

phkehl commented Apr 13, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants