Skip to content
Vega-Lite templates

Chemistry — Chart: pH of Common Foods

Approximate pH values of everyday substances.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "pH of common substances",
  "data": {"values": [
    {"item": "Lemon", "pH": 2.0},
    {"item": "Vinegar", "pH": 2.8},
    {"item": "Tomato", "pH": 4.5},
    {"item": "Coffee", "pH": 5.0},
    {"item": "Milk", "pH": 6.5},
    {"item": "Water", "pH": 7.0},
    {"item": "Baking soda", "pH": 9.0},
    {"item": "Bleach", "pH": 12.5}
  ]},
  "mark": "bar",
  "encoding": {
    "x": {"field": "item", "type": "nominal", "sort": "y", "title": "Substance"},
    "y": {"field": "pH", "type": "quantitative", "title": "pH"},
    "color": {"field": "pH", "type": "quantitative", "scale": {"scheme": "redyellowblue"}}
  }
}