Skip to content
Vega-Lite templates

Externalities — Negative Production

Private vs social cost showing deadweight loss from negative externality.

Template previewVega-Lite
Rendering…

Make it your own.

{
  "$schema":"https://vega.github.io/schema/vega-lite/v5.json",
  "data":{"values":[
    {"q":0,"p":1,"k":"Demand"},{"q":12,"p":7,"k":"Demand"},
    {"q":0,"p":2,"k":"MPC"},{"q":12,"p":8,"k":"MPC"},
    {"q":0,"p":4,"k":"MSC"},{"q":12,"p":10,"k":"MSC"}
  ]},
  "mark":{"type":"line","strokeWidth":3},
  "encoding":{
    "x":{"field":"q","type":"quantitative","title":"Quantity"},
    "y":{"field":"p","type":"quantitative","title":"Price"},
    "color":{"field":"k","type":"nominal","scale":{"range":["#3666ff","#16a34a","#dc2626"]}}
  },
  "width":420,"height":300
}