Basic Line Plot 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 Line Plot in Python, R, Julia and JavaScript.

A basic line plot connects data points with straight lines to show how a continuous variable changes over a sequence or time. It's ideal for revealing trends, patterns, and changes in data over ordered intervals. The simplicity of a single-line design makes it easy to interpret at a glance.

Basic Line Plot rendered with Makie.jl

Renders

Julia source (Makie.jl)

# anyplot.ai
# line-basic: Basic Line Plot
# Library: makie 0.21.9 | Julia 1.11.9
# Quality: 92/100 | Created: 2026-08-24

using CairoMakie
using Colors
using Random

Random.seed!(42)

# --- 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",
]
const BRAND = IMPRINT_PALETTE[1]

# --- Data ---------------------------------------------------------------
# Hourly temperature readings over a single day (24 hourly samples).
hours = 0:23
base_curve = 14 .+ 9 .* sin.((hours .- 6) .* (pi / 14))
temperatures = base_curve .+ randn(length(hours)) .* 0.6
temperatures[1:6] .-= 0.4 .* (6 .- (1:6))

# --- Plot -----------------------------------------------------------------
fig = Figure(
    size            = (1600, 900),
    fontsize        = 14,
    backgroundcolor = PAGE_BG,
)

title_str = "line-basic · julia · makie · anyplot.ai"

ax = Axis(
    fig[1, 1];
    title              = title_str,
    titlesize          = 20,
    titlecolor         = INK,
    xlabel             = "Hour of Day",
    ylabel             = "Temperature (°C)",
    xlabelsize         = 14,
    ylabelsize         = 14,
    xlabelcolor        = INK,
    ylabelcolor        = INK,
    xticklabelsize     = 12,
    yticklabelsize     = 12,
    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,
    ygridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),
    xgridvisible       = false,
    xminorgridvisible  = false,
    yminorgridvisible  = false,
    xticks             = (0:4:23, string.(0:4:23) .* ":00"),
)

# Shade the midday plateau to give the chart a focal point before drawing the line.
vspan!(ax, 10.5, 15.5; color = RGBAf(BRAND, 0.08f0))

lines!(ax, hours, temperatures; color = BRAND, linewidth = 3.5)
scatter!(ax, hours, temperatures; color = BRAND, markersize = 10, strokewidth = 0)

# Highlight and label the daily peak.
peak_idx = argmax(temperatures)
peak_hour, peak_temp = hours[peak_idx], temperatures[peak_idx]
scatter!(ax, [peak_hour], [peak_temp]; color = BRAND, markersize = 16, strokewidth = 2, strokecolor = INK)
text!(
    ax, peak_hour, peak_temp;
    text     = "Peak: $(round(peak_temp, digits = 1))°C",
    align    = (:center, :bottom),
    offset   = (0, 12),
    fontsize = 13,
    color    = INK,
    space    = :data,
)

xlims!(ax, -0.5, 23.5)
ylims!(ax, minimum(temperatures) - 2, maximum(temperatures) + 3)

# --- 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/line-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": "line-basic",
  "language": "julia",
  "library": "makie",
  "page": "https://anyplot.ai/line-basic/julia/makie",
  "hub": "https://anyplot.ai/line-basic",
  "code_json": "https://api.anyplot.ai/specs/line-basic/makie/code",
  "spec_json": "https://api.anyplot.ai/specs/line-basic",
  "render_light_png": "https://storage.googleapis.com/anyplot-images/plots/line-basic/julia/makie/plot-light.png",
  "render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/line-basic/julia/makie/plot-dark.png",
  "quality_score": 92.0,
  "license": "MIT",
  "guide": "https://anyplot.ai/llms.txt"
}

Part of Basic Line Plot on anyplot.ai.

Other implementations