diff --git a/src/GMT.jl b/src/GMT.jl index a7ffe9f96..dcf762116 100644 --- a/src/GMT.jl +++ b/src/GMT.jl @@ -456,6 +456,7 @@ using .Laszip plot(rand(5, 2)) #bar(1:5, (20, 35, 30, 35, 27), width=0.5, color=:lightblue, limits=(0.5,5.5,0,40)) sample1d([0 0; 4 1], inc=0.5); + #mosaic([-10.0, -8.0], [37.0, 39.0], zoom=10, quadonly=true, provider="Bing"); # Adds the ABSURD AMOUNT OF ~8 MB #gridit(rand(10,3), preproc=true, I=0.1); #earthregions("PT", Vd=2); #violin(rand(50), fmt=:ps); diff --git a/src/compass.jl b/src/compass.jl index 26eba23da..fdf18292f 100644 --- a/src/compass.jl +++ b/src/compass.jl @@ -67,6 +67,7 @@ function compass(first::Bool, d::Dict{Symbol, Any}) :map, :inside, :outside, :norm, :paper, :fancy, :dec, :rose_primary, :rose_secondary, :annot) + !first && !haskey(d, :inside) && (d[:inside] = :TR) # Default position nt_pairs = Pair{Symbol,Any}[] for k in compass_keys haskey(d, k) && push!(nt_pairs, k => pop!(d, k)) @@ -80,7 +81,7 @@ function compass(first::Bool, d::Dict{Symbol, Any}) # Get the width to size the canvas (default 5 cm) w = 5.0 for p in nt_pairs - if p.first === :width + if (p.first === :width) w = isa(p.second, Real) ? Float64(p.second) : 5.0 break end @@ -91,12 +92,10 @@ function compass(first::Bool, d::Dict{Symbol, Any}) # Default anchor to center of canvas in paper coordinates if not provided has_anchor = any(p -> p.first === :anchor, nt_pairs) has_coord = any(p -> p.first in (:map, :inside, :outside, :norm, :paper), nt_pairs) - if !has_anchor && !has_coord - # No positioning at all — center the rose on the canvas + if (!has_anchor && !has_coord) # No positioning at all — center the rose on the canvas push!(nt_pairs, :paper => "$(sz/2)/$(sz/2)") push!(nt_pairs, :justify => :CM) - elseif has_anchor && !has_coord - # User gave anchor but no coordinate system — use paper coords + elseif (has_anchor && !has_coord) # User gave anchor but no coordinate system — use paper coords anc = pop_anchor!(nt_pairs) push!(nt_pairs, :paper => isa(anc, Tuple) ? join(anc, '/') : string(anc)) end @@ -117,7 +116,7 @@ end # Helper to pop :anchor from nt_pairs and return its value function pop_anchor!(pairs::Vector{Pair{Symbol,Any}}) for i in eachindex(pairs) - if pairs[i].first === :anchor + if (pairs[i].first === :anchor) val = pairs[i].second deleteat!(pairs, i) return val diff --git a/test/test_PSs.jl b/test/test_PSs.jl index 8cda90d4e..4727191bf 100644 --- a/test/test_PSs.jl +++ b/test/test_PSs.jl @@ -59,7 +59,7 @@ r = compass(width=6, dec=-14.5, rose_primary=(0.25,:blue), rose_secondary=0.5, V basemap(region=(-10,10,-10,10), proj=:Mercator, frame=:auto, Vd=dbg2) r = compass!(width=2.5, anchor=(0,0), justify=:CM, fancy=true, labels=",,,N", Vd=dbg2); @test contains(r, " -R -J") || contains(r, "-R-10/10/-10/10 -J ") -@test contains(r, "-Tdj0/0+w2.5+jCM+l,,,N+f") +@test contains(r, "-TdjTR0/0+w2.5+jCM+l,,,N+f") # frame=:none is default (no explicit frame draws no axes) r = compass(width=3, fancy=true, Vd=dbg2); @test !contains(r, "-B")