|
| 1 | +# Test file for broken-axis via plot() — run from the repo root: |
| 2 | +# julia --project=. test_brokenaxes.jl |
| 3 | + |
| 4 | +using GMT |
| 5 | + |
| 6 | +# ── Example 1: simple sin wave, skip the middle stretch ─────────────────── |
| 7 | +x = collect(0.0:0.05:10.0) |
| 8 | +D1 = mat2ds([x sin.(x)]) |
| 9 | + |
| 10 | +plot(D1; breakx=(2, 8), lw=1.5, lc=:blue, region=(0, 10, -1.2, 1.2), |
| 11 | + xlabel="x", ylabel="sin(x)", title="Broken x-axis (breakx)") |
| 12 | + |
| 13 | +# ── Example 2: explicit xranges, three panels ───────────────────────────── |
| 14 | +x2 = collect(0.0:0.1:30.0) |
| 15 | +D2 = mat2ds([x2 sin.(x2 ./ 3) .* exp.(-x2 ./ 20)]) |
| 16 | + |
| 17 | +plot(D2; xranges=[(0,4),(10,14),(24,30)], gap=0.4, lw=1, title="Three panels (xranges=)") |
| 18 | + |
| 19 | +# ── Example 3: broken Y axis (breaky) ───────────────────────────────────── |
| 20 | +x3 = collect(0.0:0.1:10.0) |
| 21 | +D3 = mat2ds([x3 [fill(1.0, 61); fill(100.0, 40)]]) |
| 22 | + |
| 23 | +plot(D3; breaky=(5, 95), lw=1.5, lc=:blue, title="Broken y-axis (breaky)") |
| 24 | + |
| 25 | +# ── Example 4: explicit yranges, three panels ───────────────────────────── |
| 26 | +x4 = collect(0.0:0.1:10.0) |
| 27 | +D4 = mat2ds([x4 [fill(0.0, 41); fill(50.0, 30); fill(200.0, 30)]]) |
| 28 | + |
| 29 | +plot(D4; yranges=[(-2,6),(44,56),(194,206)], gap=0.4, lw=1, title="Three y-panels (yranges=)") |
0 commit comments