Add a vertical line to an AoG plot

In ggplot2, I can add a vertical line like this. How to do it in AoG?

ggplot(df, aes(x=x, y=y)) +
  geom_point() +

Would something like this work alright?

using AlgebraOfGraphics, CairoMakie, DataFrames

df = DataFrame(x=1:10, y=rand(10))

plt = data(df) * mapping(:x, :y) +
    mapping([5, 6, 7]) * visual(VLines; color=:blue, linestyle=:dash)


That looks good. What package/version is VLines in?

It’s a part of Makie. It (and others) were turned into recipes a while back, so they can be called by the current release of AoG now I believe

1 Like