vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.69k stars 612 forks source link

Blank chart when time is involved. #7267

Closed sizhky closed 3 years ago

sizhky commented 3 years ago

Hi I was going through Altair's tutorial here - https://altair-viz.github.io/altair-tutorial/notebooks/03-Binning-and-aggregation.html

and ran

from vega_datasets import data
temps = data.seattle_temps.url
alt.Chart(temps).mark_point().encode(
    x=alt.X('month(date):T'),
    y='temp:Q'
)

that produces following json

{
  "config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
  "data": {
    "url": "https://vega.github.io/vega-datasets/data/seattle-temps.csv"
  },
  "mark": "point",
  "encoding": {
    "x": {"type": "temporal", "field": "date", "timeUnit": "month"},
    "y": {"type": "quantitative", "field": "temp"}
  },
  "$schema": "https://vega.github.io/schema/vega-lite/v4.8.1.json"
}

but it creates a blank plot as shown in screenshot below

image

Edit

Error persists even when using "$schema": "https://vega.github.io/schema/vega-lite/v5.json"

Please:

domoritz commented 3 years ago

Use seattle-weather-hourly-normals.csv. The vega datasets package for python needs to be updated.

See https://github.com/vega/vega-datasets/blob/master/CHANGELOG.md#version-20

If you want to see the right chart, use the jsdelivr cdn and get the dataset from there: https://cdn.jsdelivr.net/npm/vega-datasets@1.31.1/data/seattle-temps.csv