Skip to content

Commit d2fe6f5

Browse files
committed
Add test_brokenaxes
1 parent 5706f09 commit d2fe6f5

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using InteractiveUtils
1717
API = GMT.GMT_Create_Session("GMT", 2, GMT.GMT_SESSION_NOEXIT + GMT.GMT_SESSION_EXTERNAL);
1818
GMT.GMT_Get_Ctrl(API);
1919

20+
include("test_brokenaxes.jl")
2021
include("test_wave_travel_time.jl")
2122
include("test_imgmorph.jl")
2223
include("test_PT_alignments.jl")

test/test_brokenaxes.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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

Comments
 (0)