VegaLite.jl
VegaLite.jl copied to clipboard
Axis scale zero:false not behaving correctly
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
vs the vega editor https://vega.github.io/editor/
{
"$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 :)
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
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?