{"spec_id":"streamline-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# streamline-basic: Basic Streamline Plot\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 91/100 | Created: 2026-09-09\n\nusing CairoMakie\nusing LinearAlgebra\n\n# --- Theme tokens (see prompts/default-style-guide.md \"Theme-adaptive Chrome\")\nconst THEME    = get(ENV, \"ANYPLOT_THEME\", \"light\")\nconst PAGE_BG  = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nconst INK      = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\n\n# --- Data: wind spiraling into a low-pressure system (Rankine vortex core --\n# with a mild radial inflow), the classic cyclone pattern in synoptic charts.\nfunction wind_velocity(x, y)\n    r = sqrt(x^2 + y^2) + 1.0e-6\n    core_radius = 20.0\n    omega = 0.6\n    tangential = r <= core_radius ? omega * r : omega * core_radius^2 / r\n    inflow = -0.05 * r\n    theta = atan(y, x)\n    u = -tangential * sin(theta) + inflow * cos(theta)\n    v = tangential * cos(theta) + inflow * sin(theta)\n    return Point2f(u, v)\nend\n\nimprint_seq = cgrad([colorant\"#009E73\", colorant\"#4467A3\"])\n\n# --- Plot ---------------------------------------------------------------------\nfig = Figure(\n    size            = (1600, 900),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title             = \"streamline-basic · julia · makie · anyplot.ai\",\n    titlesize         = 20,\n    titlecolor        = INK,\n    xlabel            = \"Distance East of Center (km)\",\n    ylabel            = \"Distance North of Center (km)\",\n    xlabelsize        = 14,\n    ylabelsize        = 14,\n    xlabelcolor       = INK,\n    ylabelcolor       = INK,\n    xticklabelsize    = 12,\n    yticklabelsize    = 12,\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    xgridvisible      = false,\n    ygridvisible      = false,\n    aspect            = DataAspect(),\n)\n\nstreamlines = streamplot!(\n    ax, wind_velocity, -60.0 .. 60.0, -60.0 .. 60.0;\n    color = p -> norm(p),\n    colormap = imprint_seq,\n    gridsize = (32, 32),\n    arrow_size = 14,\n    linewidth = 2.5,\n)\n\nColorbar(\n    fig[1, 2], streamlines;\n    label = \"Wind Speed (m/s)\",\n    labelsize = 14,\n    labelcolor = INK,\n    ticklabelsize = 12,\n    ticklabelcolor = INK_SOFT,\n    tickcolor = INK_SOFT,\n    width = 18,\n)\n\n# DataAspect() forces the axis into a square; tie the column width to the row\n# height (rather than a fixed Relative share of the figure) so the colorbar\n# hugs the axis instead of floating in leftover 16:9 whitespace.\ncolsize!(fig.layout, 1, Aspect(1, 1.0))\ncolgap!(fig.layout, 1, 16)\n\n# --- Save ----------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}