Skip to content
Vega-Lite templates

Chemistry — Flame Test Colours

Characteristic flame colours of metal ions.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Flame test colours",
  "data": {"values": [
    {"metal":"Lithium","flame":"Crimson","wavelength":670},
    {"metal":"Sodium","flame":"Yellow","wavelength":589},
    {"metal":"Potassium","flame":"Lilac","wavelength":404},
    {"metal":"Calcium","flame":"Orange-red","wavelength":620},
    {"metal":"Copper","flame":"Green","wavelength":525},
    {"metal":"Barium","flame":"Green","wavelength":515}
  ]},
  "mark": "bar",
  "encoding": {
    "x": {"field":"metal","type":"nominal","title":"Metal ion"},
    "y": {"field":"wavelength","type":"quantitative","title":"approx wavelength (nm)"},
    "color": {"field":"flame","type":"nominal","title":"Flame colour"}
  }
}