Vegalite.jl: use dots for separation sign

Is there a setting to use . instead of , for digit separation in the resulting plot itself?

(E.g., 1.000 instead of 1,000 for a thousand.)

Alternatively, is there a setting to use a space character?

You can use labelExpr as in the following example:

using VegaLite, DataFrames

data = DataFrame(
    x=[1,2,3,4,5,6,7],
    y=[10,30,missing,15,missing,40,20]
)

data |>
@vlplot(
    mark={
        :line,
        point=true
    },
    x={"x:q",axis={labelExpr="format(datum.label,'.1f')"}},
    y=:y
)

which changes the x labels from integer to floats.
The format specifier is a d3-format specifier:

And see also

Changing . to , is probably a locale setting in d3-formats, but I didn’t found out how to set them from VegaLite/Vega

So, e.g. if you can’t find the proper d3-format, you can provide the labels explicit in the data, e.g. based on the above example:

data[!,:labels]=["1,0","2,0","3,0","4,0","5,0","6,0","7,0"]
data |>
       @vlplot(
           mark={
               :line,
               point=true
           },
           x={"labels:n",title="x"},
           y=:y
       )

The details depend on the type of plot you are going to create.

2 Likes

Thanks, though it seems very cumbersome in Vegalite like that.

VegaLite is somehow cumbersome.
VegaLite.jl is already less cumbersome :wink:

Indeed, and most useful.