vegalite icon indicating copy to clipboard operation
vegalite copied to clipboard

clash of vegalite versions using from_spec()

Open espinielli opened this issue 6 years ago • 1 comments

When I try one of the simple vegalite examples like:

from_spec('{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
          "description": "A simple bar chart with embedded data.",
          "data": {
          "values": [
          {"a": "A","b": 28}, {"a": "B","b": 55}, {"a": "C","b": 43},
          {"a": "D","b": 91}, {"a": "E","b": 81}, {"a": "F","b": 53},
          {"a": "G","b": 19}, {"a": "H","b": 87}, {"a": "I","b": 52}
          ]
          },
          "mark": "bar",
          "encoding": {
          "x": {"field": "a", "type": "ordinal"},
          "y": {"field": "b", "type": "quantitative"}
          }
          }')

I correctly get the relevant plot.

With the following one, the cloropleth example with data files pointing to relevant URLs, nothing is displayed and no error is reported:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.1.json",
  "width": 500,
  "height": 300,
  "data": {
    "url": "https://raw.githubusercontent.com/vega/editor/master/data/us-10m.json",
    "format": {
      "type": "topojson",
      "feature": "counties"
    }
  },
  "transform": [
    {
      "lookup": "id",
      "from": {
        "data": {
          "url": "https://raw.githubusercontent.com/vega/editor/master/data/unemployment.tsv"
        },
        "key": "id",
        "fields": [
          "rate"
        ]
      }
    }
  ],
  "projection": {
    "type": "albersUsa"
  },
  "mark": "geoshape",
  "encoding": {
    "color": {
      "field": "rate",
      "type": "quantitative"
    }
  }
}

The above spec in Vega-lite Editor works flowlessly.

It looks like the issue is with vegalite version in the package with respect to the one defined in the spec, in the web console of the detached plot I get:

 The input spec uses vega-lite v2.1, but the current version of Vega-Lite is 2.0.1.

espinielli avatar May 20 '18 13:05 espinielli

That would be great to be able to run this – vega was much extended and it is currently, as far as I am concerned, not possible to use these extended capabilities from R.

jdittrich avatar Sep 02 '18 10:09 jdittrich