Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axis scale zero:false not behaving correctly #342

Open
seanlaff opened this issue Nov 18, 2020 · 2 comments
Open

Axis scale zero:false not behaving correctly #342

seanlaff opened this issue Nov 18, 2020 · 2 comments
Labels

Comments

@seanlaff
Copy link

I'm notice a discrepancy with the same spec in the vega editor, vs plotted with this lib, with regards to "scale": {"zero": false}.

Julia
image
vs the vega editor https://vega.github.io/editor/
image

{
  "$schema": "https://vega.github.io/schema/vega-lite/v4.json",
  "width": 400,
  "data": {
    "values": [
      {
        "time": "2020-01-02T11:30:00",
        "open": 3000,
        "close": 3100,
        "high": 3200,
        "low": 2980,
        "volume": 100
      },
      {
        "time": "2020-02-02T11:30:00",
        "open": 3000,
        "close": 3100,
        "high": 3200,
        "low": 2980,
        "volume": 100
      }
    ]
  },
  "encoding": {
    "x": {"field": "time", "type": "temporal"},
    "y": {
      "type": "quantitative",
      "scale": {"zero": false},
      "axis": {"title": "Price"}
    },
    "color": {
      "condition": {"test": "datum.open < datum.close", "value": "#06982d"},
      "value": "#ae1325"
    }
  },
  "layer": [
    {
      "mark": "rule",
      "encoding": {"y": {"field": "low"}, "y2": {"field": "high"}}
    },
    {
      "mark": "bar",
      "encoding": {"y": {"field": "open"}, "y2": {"field": "close"}}
    }
  ]
}

I init'd this with vl"""..."""

If Im misusing the api, please let me know :)

@seanlaff
Copy link
Author

Tried to debug this a little more, when I specify the zero on both y and y2, things look good 👍

smp |> @vlplot(
	mark=:bar,
        x={"dateTime:t"},
	y={"open:q", scale={zero=false}},
	y2={"close:q", scale={zero=false}}
)

however, trying this exhibits the incorrect behavior

smp |> @vlplot(
	mark=:bar,
        encoding={
		y={scale={zero=false}}
	},
	y={"open:q"},
	y2={"close:q"}
)

Seems like the scale = zero from the encoding block is overwritten

@davidanthoff
Copy link
Member

I just tagged a new version of the package, with updated versions of the underlying Javascript libraries. My best guess is that we had been using an outdated version of vega-lite. Could you try again with the latest version of VegaLite.jl, v2.4.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants