livebook-dev / vega_lite

Elixir bindings for Vega-Lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VegaLite.new/0 makes x axis go to top

theevangelista opened this issue · comments

From the post on Elixirforum it seems that while rendering the chart vega_lite is placing the x axis at the top instead of the bottom while using the Vl.new/0 initializing function, this behavior is fixed by using VegaLite.new(width: 100, height: 100) (any size, even smaller).
Even using something like

Vl.new()
|> Vl.encode_field(:x, "myaxis", axis: [orient: "bottom"])

does not work.

On the top without size in new:
visualization
With size of 10x10:
visualization(1)
With size of 100x100:
visualization(2)

Livebook if needed: vegalite-issue.livemd.txt

Hey @sleepiejohn!

First of all, this package only produces a Vega-Lite specification, which in this case works as expected, but the chart indeed ends up weird. For the record here is a plain Vega-Lite reproduction.

We could open an issue upstream, but when I think about it, I'm not really sure what the behaviour of two independent nominal axes should be, so I can imagine the chart gets all confused.

In the given example the axis represent quantitative values, so the encodings should specify type: :quantitative, which helps. If there actually were multiple nominal axes, then it's a much better idea to encode them as color/shape :)