Basic Histogram in Makie.jl (Julia)

The same plot in 14 other libraries — Python: Altair, Bokeh, lets-plot, Matplotlib, Plotly, plotnine, Pygal, Seaborn; R: ggplot2; JavaScript: Chart.js, D3.js, Apache ECharts, Highcharts, MUI X Charts. Compare all 15 side by side: Basic Histogram in Python, R, Julia and JavaScript.

A histogram displays the distribution of a single continuous variable by dividing the data range into bins and showing the frequency (count) of observations in each bin. It reveals the shape of the data distribution, including central tendency, spread, and presence of outliers or multiple modes.

Basic Histogram rendered with Makie.jl

Renders

Julia source (Makie.jl)

# anyplot.ai
# histogram-basic: Basic Histogram
# Library: makie 0.24.16 | Julia 1.13.4
# Quality: 84/100 | Updated: 2026-11-26

using CairoMakie
using Colors
using DataFrames
using Random

# Theme tokens
const THEME    = get(ENV, "ANYPLOT_THEME", "light")
const PAGE_BG  = THEME == "light" ? colorant"#FAF8F1" : colorant"#1A1A17"
const INK      = THEME == "light" ? colorant"#1A1A17" : colorant"#F0EFE8"
const INK_SOFT = THEME == "light" ? colorant"#4A4A44" : colorant"#B8B7B0"
const IMPRINT_PALETTE = [
    colorant"#009E73", colorant"#C475FD", colorant"#4467A3", colorant"#BD8233",
    colorant"#AE3030", colorant"#2ABCCD", colorant"#954477", colorant"#99B314",
]

# Columns: set these to your table's column names
const CUSTOMER_AGE = "Customer age (years)"  # role: value

# Data: replace this block with your own table, for example df = CSV.read("customers.csv", DataFrame)
Random.seed!(42)
ages_young = randn(200) .* 5 .+ 28
ages_mid = randn(150) .* 8 .+ 55
df = DataFrame(CUSTOMER_AGE => clamp.(vcat(ages_young, ages_mid), 18, 75))

# Plot: reads only df and the constants above
fig = Figure(
    size = (1600, 900),
    fontsize = 14,
    backgroundcolor = PAGE_BG,
)

ax = Axis(
    fig[1, 1];
    title = "histogram-basic · julia · makie · anyplot.ai",
    titlesize = 24,
    titlecolor = INK,
    xlabel = CUSTOMER_AGE,
    ylabel = "Count",
    xlabelsize = 20,
    ylabelsize = 20,
    xlabelcolor = INK,
    ylabelcolor = INK,
    xticklabelsize = 17,
    yticklabelsize = 17,
    xticklabelcolor = INK_SOFT,
    yticklabelcolor = INK_SOFT,
    xtickcolor = INK_SOFT,
    ytickcolor = INK_SOFT,
    backgroundcolor = PAGE_BG,
    topspinevisible = false,
    rightspinevisible = false,
    leftspinecolor = INK_SOFT,
    bottomspinecolor = INK_SOFT,
    xgridvisible = false,
    ygridcolor = RGBAf(INK.r, INK.g, INK.b, 0.15f0),
    xminorgridvisible = false,
    yminorgridvisible = false,
    limits = (nothing, nothing, 0, nothing),
)

hist!(ax, df[!, CUSTOMER_AGE];
    bins = 28,
    color = IMPRINT_PALETTE[1],
    strokecolor = PAGE_BG,
    strokewidth = 1.5,
)

# Save
save("plot-$(THEME).png", fig; px_per_unit = 2)

Retrieve this implementation

Runnable source as JSON, for any HTTP client: https://api.anyplot.ai/specs/histogram-basic/makie/code. Any spec id and library id listed in llms-full.txt fit the same URL shape; every URL below is complete and callable.

{
  "spec_id": "histogram-basic",
  "language": "julia",
  "library": "makie",
  "page": "https://anyplot.ai/histogram-basic/julia/makie",
  "hub": "https://anyplot.ai/histogram-basic",
  "code_json": "https://api.anyplot.ai/specs/histogram-basic/makie/code",
  "spec_json": "https://api.anyplot.ai/specs/histogram-basic",
  "render_light_png": "https://storage.googleapis.com/anyplot-images/plots/histogram-basic/julia/makie/plot-light.png",
  "render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/histogram-basic/julia/makie/plot-dark.png",
  "quality_score": 84.0,
  "license": "MIT",
  "guide": "https://anyplot.ai/llms.txt"
}

Part of Basic Histogram on anyplot.ai.

Other implementations