Histogram with mean overlay

Source code Author

using Deneb

data = Data(url="https://vega.github.io/vega-datasets/data/movies.json")

bar = Mark(:bar) * Encoding(
    x=field("IMDB Rating:Q", bin=true),
    y="count()"
)

rule = Mark(:rule, color=:red, size=5) * Encoding(x="mean(IMDB Rating)")

chart = data * (bar + rule)

This page was generated using DemoCards.jl and Literate.jl.