Skip to content

Instantly share code, notes, and snippets.

@declann
Created February 3, 2022 02:24
Show Gist options
  • Select an option

  • Save declann/63162f72748bea64f9fc35ad0a0711d9 to your computer and use it in GitHub Desktop.

Select an option

Save declann/63162f72748bea64f9fc35ad0a0711d9 to your computer and use it in GitHub Desktop.
test gist from vega editor
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"name": "projection"},
"width": 800,
"transform": [
{
"fold": [
"cases_deaths_link_smoothed",
"cases_smoothed",
"deaths_smoothed"
]
}
],
"layer": [
{
"mark": {"type": "line", "tooltip": true, "strokeWidth": 2},
"transform": [
{
"filter": "datum.key == 'cases_deaths_link_smoothed' && datum.value >= 0"
}
],
"encoding": {
"x": {"field": "t_in", "timeUnit": "yearmonthdate"},
"y": {"field": "value", "type": "quantitative"},
"color": {"value": "blue"}
}
},
{
"mark": {"type": "line", "tooltip": true},
"transform": [
{"filter": "datum.key == 'cases_smoothed' && datum.value >= 0"}
],
"encoding": {
"x": {"field": "t_in", "timeUnit": "yearmonthdate"},
"y": {"field": "value", "type": "quantitative"},
"color": {"value": "green"},
"opacity": {"value": 0.6}
}
},
{
"mark": {"type": "line", "tooltip": true},
"transform": [
{"filter": "datum.key == 'deaths_smoothed' && datum.value >= 0"}
],
"encoding": {
"x": {"field": "t_in", "timeUnit": "yearmonthdate"},
"y": {"field": "value", "type": "quantitative"},
"color": {"value": "red"},
"opacity": {"value": 0.6}
}
}
],
"resolve": {"scale": {"y": "independent"}},
"datasets": {
"projection": [
{
"t_in": "2020-03-31T23:00:00.000Z",
"cases_deaths_link_smoothed": 3.2763194252555956,
"cases_smoothed": 269,
"deaths_smoothed": 10.857
},
{
"t_in": "2020-04-01T23:00:00.000Z",
"cases_deaths_link_smoothed": 6.506202374623427,
"cases_smoothed": 290,
"deaths_smoothed": 11.286
},
{
"t_in": "2020-04-02T23:00:00.000Z",
"cases_deaths_link_smoothed": 6.051,
"cases_smoothed": 307.429,
"deaths_smoothed": 14
},
{
"t_in": "2020-04-03T23:00:00.000Z",
"cases_deaths_link_smoothed": 6.494836787026128,
"cases_smoothed": 312.714,
"deaths_smoothed": 14.429
},
{
"t_in": "2020-04-04T23:00:00.000Z",
"cases_deaths_link_smoothed": 6.9375,
"cases_smoothed": 339.857,
"deaths_smoothed": 16
},
{
"t_in": "2020-04-05T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.966575278539345,
"cases_smoothed": 350.571,
"deaths_smoothed": 17.143
},
{
"t_in": "2020-04-06T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.9568917761998295,
"cases_smoothed": 353.429,
"deaths_smoothed": 19.857
},
{
"t_in": "2020-04-07T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.47981707032526,
"cases_smoothed": 375.286,
"deaths_smoothed": 21.429
},
{
"t_in": "2020-04-08T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.648636035806711,
"cases_smoothed": 389.286,
"deaths_smoothed": 23.571
},
{
"t_in": "2020-04-09T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.610847969149516,
"cases_smoothed": 545.143,
"deaths_smoothed": 23.857
},
{
"t_in": "2020-04-10T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.90704968825307,
"cases_smoothed": 617.714,
"deaths_smoothed": 26.143
},
{
"t_in": "2020-04-11T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.710177783080777,
"cases_smoothed": 665.857,
"deaths_smoothed": 25.143
},
{
"t_in": "2020-04-12T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.345451880085024,
"cases_smoothed": 754.714,
"deaths_smoothed": 27.286
},
{
"t_in": "2020-04-13T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.7245,
"cases_smoothed": 824.286,
"deaths_smoothed": 28
},
{
"t_in": "2020-04-14T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.009612486184144,
"cases_smoothed": 924.714,
"deaths_smoothed": 29.857
},
{
"t_in": "2020-04-15T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.103179834887152,
"cases_smoothed": 956.714,
"deaths_smoothed": 31.857
},
{
"t_in": "2020-04-16T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.856052313187762,
"cases_smoothed": 841.571,
"deaths_smoothed": 34.714
},
{
"t_in": "2020-04-17T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.721142315308029,
"cases_smoothed": 832.857,
"deaths_smoothed": 35.857
},
{
"t_in": "2020-04-18T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.619467904334373,
"cases_smoothed": 799.429,
"deaths_smoothed": 39.429
},
{
"t_in": "2020-04-19T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.6211086956521745,
"cases_smoothed": 715,
"deaths_smoothed": 46
},
{
"t_in": "2020-04-20T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.635764594045715,
"cases_smoothed": 651.571,
"deaths_smoothed": 46.286
},
{
"t_in": "2020-04-21T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.08300846453725,
"cases_smoothed": 589.143,
"deaths_smoothed": 46.429
},
{
"t_in": "2020-04-22T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.84740909090909,
"cases_smoothed": 619.429,
"deaths_smoothed": 44
},
{
"t_in": "2020-04-23T23:00:00.000Z",
"cases_deaths_link_smoothed": 7.884283296935338,
"cases_smoothed": 600.571,
"deaths_smoothed": 69.143
},
{
"t_in": "2020-04-24T23:00:00.000Z",
"cases_deaths_link_smoothed": 8.788578095210996,
"cases_smoothed": 543.286,
"deaths_smoothed": 70.286
},
{
"t_in": "2020-04-25T23:00:00.000Z",
"cases_deaths_link_smoothed": 9.771465887912184,
"cases_smoothed": 573,
"deaths_smoothed": 68.143
},
{
"t_in": "2020-04-26T23:00:00.000Z",
"cases_deaths_link_smoothed": 12.730054312991264,
"cases_smoothed": 570.857,
"deaths_smoothed": 59.286
},
{
"t_in": "2020-04-27T23:00:00.000Z",
"cases_deaths_link_smoothed": 13.449825408739352,
"cases_smoothed": 548.143,
"deaths_smoothed": 61.286
},
{
"t_in": "2020-04-28T23:00:00.000Z",
"cases_deaths_link_smoothed": 15.375255640722944,
"cases_smoothed": 511.714,
"deaths_smoothed": 60.143
},
{
"t_in": "2020-04-29T23:00:00.000Z",
"cases_deaths_link_smoothed": 15.290054498090171,
"cases_smoothed": 429.286,
"deaths_smoothed": 62.571
},
{
"t_in": "2020-04-30T23:00:00.000Z",
"cases_deaths_link_smoothed": 23.470201076498313,
"cases_smoothed": 378.429,
"deaths_smoothed": 35.857
},
{
"t_in": "2020-05-01T23:00:00.000Z",
"cases_deaths_link_smoothed": 26.143610509464168,
"cases_smoothed": 373.571,
"deaths_smoothed": 31.857
},
{
"t_in": "2020-05-02T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.907541238616844,
"cases_smoothed": 320.571,
"deaths_smoothed": 30.857
},
{
"t_in": "2020-05-03T23:00:00.000Z",
"cases_deaths_link_smoothed": 23.06451612903226,
"cases_smoothed": 303.429,
"deaths_smoothed": 31
},
{
"t_in": "2020-05-04T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.339153768375205,
"cases_smoothed": 300.857,
"deaths_smoothed": 25.714
},
{
"t_in": "2020-05-05T23:00:00.000Z",
"cases_deaths_link_smoothed": 22.291535812932764,
"cases_smoothed": 285,
"deaths_smoothed": 26.429
},
{
"t_in": "2020-05-06T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.356297842727905,
"cases_smoothed": 253.286,
"deaths_smoothed": 24.429
},
{
"t_in": "2020-05-07T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.63365914038158,
"cases_smoothed": 244,
"deaths_smoothed": 23.429
},
{
"t_in": "2020-05-08T23:00:00.000Z",
"cases_deaths_link_smoothed": 23.768911055694097,
"cases_smoothed": 226.286,
"deaths_smoothed": 22.857
},
{
"t_in": "2020-05-09T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.877252404823192,
"cases_smoothed": 212.857,
"deaths_smoothed": 22.143
},
{
"t_in": "2020-05-10T23:00:00.000Z",
"cases_deaths_link_smoothed": 26.999810812089105,
"cases_smoothed": 194.714,
"deaths_smoothed": 21.143
},
{
"t_in": "2020-05-11T23:00:00.000Z",
"cases_deaths_link_smoothed": 25.751338908202573,
"cases_smoothed": 179.857,
"deaths_smoothed": 21.286
},
{
"t_in": "2020-05-12T23:00:00.000Z",
"cases_deaths_link_smoothed": 29.359917379080844,
"cases_smoothed": 164.714,
"deaths_smoothed": 17.429
},
{
"t_in": "2020-05-13T23:00:00.000Z",
"cases_deaths_link_smoothed": 29.175343210547776,
"cases_smoothed": 206,
"deaths_smoothed": 14.714
},
{
"t_in": "2020-05-14T23:00:00.000Z",
"cases_deaths_link_smoothed": 29.764747522416233,
"cases_smoothed": 202.143,
"deaths_smoothed": 12.714
},
{
"t_in": "2020-05-15T23:00:00.000Z",
"cases_deaths_link_smoothed": 30.056400354010783,
"cases_smoothed": 184,
"deaths_smoothed": 12.429
},
{
"t_in": "2020-05-16T23:00:00.000Z",
"cases_deaths_link_smoothed": 26.399654121716218,
"cases_smoothed": 159.429,
"deaths_smoothed": 12.143
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment