{"spec_id":"bump-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# bump-basic: Basic Bump Chart\n# Library: makie 0.24.16 | Julia 1.13.4\n# Quality: 86/100 | Updated: 2026-11-27\n\nusing CairoMakie\nusing Colors\nusing DataFrames\nusing Random\n\n# Theme tokens\nconst THEME       = get(ENV, \"ANYPLOT_THEME\", \"light\")\nconst PAGE_BG     = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nconst ELEVATED_BG = THEME == \"light\" ? colorant\"#FFFDF6\" : colorant\"#242420\"\nconst INK         = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT    = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\nconst GRID_INK    = THEME == \"light\" ?\n    RGBAf(26 / 255, 26 / 255, 23 / 255, 0.12) :\n    RGBAf(240 / 255, 239 / 255, 232 / 255, 0.12)\n\nconst IMPRINT_PALETTE = [\n    colorant\"#009E73\",\n    colorant\"#C475FD\",\n    colorant\"#4467A3\",\n    colorant\"#BD8233\",\n    colorant\"#AE3030\",\n    colorant\"#2ABCCD\",\n]\n\nRandom.seed!(42)\n\n# Columns: set these to your table's column names\nconst COMPANY = \"Company\"   # role: group\nconst QUARTER = \"Quarter\"   # role: category\nconst RANK = \"Rank\"         # role: value\n\n# Data: tech startup investor-ranking competition, Q1 2023 to Q2 2024\nquarter_labels = [\"Q1'23\", \"Q2'23\", \"Q3'23\", \"Q4'23\", \"Q1'24\", \"Q2'24\"]\nrankings = [\n    2  1  1  1  1  2;   # NovaTech\n    4  3  2  2  2  1;   # PulseAI\n    1  2  3  3  3  3;   # CircleCloud\n    3  4  4  4  4  4;   # ApexRobotics\n    6  5  5  5  5  5;   # QuantumIO\n    5  6  6  6  6  6;   # ShieldSec\n]\ncompany_names = [\"NovaTech\", \"PulseAI\", \"CircleCloud\", \"ApexRobotics\", \"QuantumIO\", \"ShieldSec\"]\ndf = DataFrame(\n    COMPANY => repeat(company_names; inner = length(quarter_labels)),\n    QUARTER => repeat(quarter_labels, length(company_names)),\n    RANK => vec(permutedims(rankings)),\n)\n\n# Plot\ncompanies = unique(df[!, COMPANY])\nquarters = unique(df[!, QUARTER])\nn_companies = length(companies)\n\nfig = Figure(\n    size            = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title              = \"bump-basic · julia · makie · anyplot.ai\",\n    titlesize          = 20,\n    titlecolor         = INK,\n    xlabel             = QUARTER,\n    ylabel             = RANK,\n    xlabelsize         = 16,\n    ylabelsize         = 16,\n    xlabelcolor        = INK,\n    ylabelcolor        = INK,\n    xticklabelsize     = 14,\n    yticklabelsize     = 14,\n    xticklabelcolor    = INK_SOFT,\n    yticklabelcolor    = INK_SOFT,\n    xtickcolor         = INK_SOFT,\n    ytickcolor         = INK_SOFT,\n    backgroundcolor    = PAGE_BG,\n    topspinevisible    = false,\n    rightspinevisible  = false,\n    leftspinecolor     = INK_SOFT,\n    bottomspinecolor   = INK_SOFT,\n    xticks             = (eachindex(quarters), quarters),\n    yticks             = 1:maximum(df[!, RANK]),\n    yreversed          = true,\n    xgridvisible       = false,\n    ygridvisible       = true,\n    ygridcolor         = GRID_INK,\n    xminorgridvisible  = false,\n    yminorgridvisible  = false,\n    limits             = (0.7, length(quarters) + 0.3, nothing, nothing),\n)\n\nfor (i, company) in enumerate(companies)\n    rows = df[df[!, COMPANY] .== company, :]\n    x = [findfirst(==(q), quarters) for q in rows[!, QUARTER]]\n    lines!(ax, x, rows[!, RANK]; color = IMPRINT_PALETTE[i], linewidth = 3.5)\n    scatter!(ax, x, rows[!, RANK];\n        color       = IMPRINT_PALETTE[i],\n        markersize  = 16,\n        strokecolor = PAGE_BG,\n        strokewidth = 2,\n    )\nend\n\nlegend_elements = [LineElement(color = IMPRINT_PALETTE[i], linewidth = 3.5) for i in 1:n_companies]\nLegend(\n    fig[1, 2],\n    legend_elements,\n    companies,\n    COMPANY;\n    titlecolor      = INK,\n    backgroundcolor = ELEVATED_BG,\n    framecolor      = INK_SOFT,\n    labelcolor      = INK,\n    labelsize       = 14,\n)\n\n# Proportion the legend column to ~18% of figure width using colsize!\ncolsize!(fig.layout, 2, Relative(0.18))\n\n# Save\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}