I have plotted a scatter plot in VegaLite.jl, however, the x-axis and y-axis don't get scaled automatically like other plotting packages (plots, plotly etc.)
For example in the following example, the plot starts x-axis from 0, whereas it would make more sense to start from a value such as 125 since x-values are clustered between 150-200. The same thing applies to the y-axis. This results in a plot that has only utilized the top right section. Any ideas on how to scale the x and y axes?
using VegaLite
x = Array{Int64}([150,175,200])
y = Array{Int64}([225,250,275])
@vlplot(
:point,
x = x,
y = y
)

You can add a scale specification, as documented in the Vega-Lite documentation or demonstrated e.g. here in the VegaLite.jl documentation.
For example:
using VegaLite
using DataFrames
data = DataFrame(x = [150,175,200], y = [225,250,275])
data |> @vlplot(
:point,
x = {:x, scale = {zero = false}}, # Auto scale, without enforcing that zero be in the domain
y = {:y, scale = {domain = (200, 300)}}, # Explicit domain
)

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With