How to plot several variables on an axis with Vega-Lite?

后端 未结 1 1317
一向
一向 2021-01-24 22:48

Following Vega-Lite\'s Seattle weather tutorial, it was easy to plot avg min temperature by month:

{
  \"$schema\": \"https://vega.github.io/schema/vega-lite/v2.         


        
相关标签:
1条回答
  • 2021-01-24 23:32

    You can use layering as described at https://vega.github.io/vega-lite/docs/layer.html.

    {
      "data": {"url": "data/seattle-weather.csv"},
      "layer": [
        {
          "mark": "line",
          "encoding": {
            "x": {
              "timeUnit": "month",
              "field": "date",
              "type": "temporal"
            },
            "y": {
              "aggregate": "mean",
              "field": "temp_min",
              "type": "quantitative"
            }
          }
        },
        {
          "mark": "line",
          "encoding": {
            "x": {
              "timeUnit": "month",
              "field": "date",
              "type": "temporal"
            },
            "y": {
              "aggregate": "mean",
              "field": "temp_max",
              "type": "quantitative"
            }
          }
        }
      ]
    }
    

    0 讨论(0)
提交回复
热议问题