Suppose I've retrieved spectral line data for an element, as so:

hydrogenSpectralLines =SpectralLineData[EntityClass["AtomicLine", {"Hydrogen", 1}]];

From that, I can extract only the visible lines, and their frequencies, using

EntityValue[x,EntityProperty["AtomicLine", "Frequency"]]

So in the end I guess what I have are really just a bunch of "Quantity" objects.

So, I've filtered for just the visible ones, and I want to visualize them as they might appear if I actually put a camera in a spectrometer. Like this image from Wikipedia, made by Jan Homann:


Should I just use Rectangle objects, or is there a "higher-level" way to approach this?


There is an example for that for SpectralLineData: here.

hydrogenSpectralLines = 
    "AtomicLine", {"Hydrogen", 1}], {Quantity[400, "Nanometers"], 
    Quantity[750, "Nanometers"]}];

hydrogenLineLengths = 
   SpectralLineData[hydrogenSpectralLines, "Wavelength"], 

Graphics[{ColorData["VisibleSpectrum"][#], Line[{{#, 0}, {#, 1}}]} & /@
   hydrogenLineLengths, Frame -> True, FrameTicks -> {True, False}, 
 AspectRatio -> 1/3, Background -> Black, 
 FrameLabel -> Quantity[None, "Nanometers"]]

hydrogen spectral lines

  • $\begingroup$ Oops, right in the help file! Thanks for pointing this out. $\endgroup$
    – user54038
    Apr 17 '20 at 13:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.