VegaLite add line manually?

Yes! Here is a version that uses some more shortcuts:

dataset("cars") |>
@vlplot(facet = {row = {field = :Origin, type = :nominal}}) + 
    (
        @vlplot() +
        @vlplot(:point, :Horsepower, :Miles_per_Gallon) +
        @vlplot(mark={:rule, color=:red}, data = {values = [{ref = 10}]}, y="ref:q")
    )

I don’t fully understand right now why this extra @vlplot() is needed as the first element for the layered sub-spec, but hey, it works :slight_smile:

I think there are really two things that we could do on the Julia side to make this easier: a) add support for the shorthand parsing to the row field, so that facet={row="Origin:n"} works. b) sort out the composition story… I’ll try to find time to look over some of the proposals we had on that.

1 Like