Line Plot with Markers — Makie.jl

A line plot with visible markers at each data point, combining line and scatter plot features. This is particularly useful for sparse data where individual observations are significant.

Line Plot with Markers rendered with Makie.jl

Renders

Julia source (Makie.jl)

# anyplot.ai
# line-markers: Line Plot with Markers
# Library: makie 0.21.9 | Julia 1.11.9
# Quality: 85/100 | Created: 2026-09-05

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",
]

# --- Data ---------------------------------------------------------------
# Quality-control readings: two production lines sampled at hourly checkpoints.
hours = 0:11
line_a = 98.2 .+ cumsum(randn(length(hours)) .* 0.6)
line_b = 96.8 .+ cumsum(randn(length(hours)) .* 0.6)

# Locate the first crossing between the two lines for a storytelling annotation.
diffs = line_a .- line_b
cross_i = findfirst(i -> sign(diffs[i]) != sign(diffs[i + 1]), 1:(length(diffs) - 1))
if cross_i !== nothing
    t = diffs[cross_i] / (diffs[cross_i] - diffs[cross_i + 1])
    cross_x = hours[cross_i] + t * (hours[cross_i + 1] - hours[cross_i])
    cross_y = line_a[cross_i] + t * (line_a[cross_i + 1] - line_a[cross_i])
end

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

ax = Axis(
    fig[1, 1];
    title              = "line-markers · julia · makie · anyplot.ai",
    titlesize          = 20,
    titlecolor         = INK,
    xlabel             = "Inspection Hour",
    ylabel             = "Yield (%)",
    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,
    xgridvisible       = false,
    ygridcolor         = RGBAf(INK.r, INK.g, INK.b, 0.15),
    xticks             = collect(hours),
)

scatterlines!(ax, hours, line_a; color = IMPRINT_PALETTE[1], linewidth = 3,
              marker = :circle, markersize = 16, strokewidth = 1.5,
              strokecolor = PAGE_BG, label = "Line A")

scatterlines!(ax, hours, line_b; color = IMPRINT_PALETTE[2], linewidth = 3,
              marker = :utriangle, markersize = 18, strokewidth = 1.5,
              strokecolor = PAGE_BG, label = "Line B")

if cross_i !== nothing
    scatter!(ax, [cross_x], [cross_y]; color = :transparent, marker = :circle,
              markersize = 30, strokewidth = 2, strokecolor = INK_SOFT)
    text!(ax, cross_x, cross_y; text = "crossover", color = INK_SOFT,
          fontsize = 12, align = (:center, :bottom), offset = (0, 16))
end

axislegend(ax; position = :rb, labelcolor = INK_SOFT, framevisible = false)

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

Part of Line Plot with Markers on anyplot.ai.

Other implementations