Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/GMT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 5 additions & 6 deletions src/compass.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function compass(first::Bool, d::Dict{Symbol, Any})
:map, :inside, :outside, :norm, :paper,
:fancy, :dec, :rose_primary, :rose_secondary, :annot)

!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))
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading