Skip to content

Commit

Permalink
Merge pull request #1368 from GenericMappingTools/cubeplot-plusplus
Browse files Browse the repository at this point in the history
cubeplot() now accepts inset and received a new method to work with cubes.
  • Loading branch information
joa-quim authored Feb 10, 2024
2 parents 2b22fe4 + 8f7a1b3 commit 1afd9eb
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 47 deletions.
13 changes: 7 additions & 6 deletions src/common_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,12 @@ function parse_B(d::Dict, cmd::String, opt_B__::String="", del::Bool=true)::Tupl
# Let the :title and x|y_label be given on main kwarg list. Risky if used with NamedTuples way.
t::String = "" # Use the trick to replace blanks by Char(127) (invisible) and undo it in extra_parse
extra_par::String, tt::String, ep::String = "", "", ""
if (haskey(d, :title)) tt, extra_par = titlices(d, d[:title], title); t *= "+t" * tt end
if (haskey(d, :subtitle)) tt, ep = titlices(d, d[:subtitle], subtitle); t *= "+s" * tt; extra_par *= ep end
if (haskey(d, :xlabel)) tt, ep = titlices(d, d[:xlabel], xlabel); t *= " x+l" * tt; extra_par *= ep end
if (haskey(d, :ylabel)) tt, ep = titlices(d, d[:ylabel], ylabel); t *= " y+l" * tt; extra_par *= ep end
if (haskey(d, :zlabel)) tt, ep = titlices(d, d[:zlabel], zlabel); t *= " z+l" * tt; extra_par *= ep end
if (haskey(d, :title) && d[:title] != "") tt, extra_par = titlices(d, d[:title], title); t *= "+t" * tt end
if (haskey(d, :subtitle) && d[:subtitle] != "") tt, ep = titlices(d, d[:subtitle], subtitle);t *= "+s" * tt; extra_par *= ep end
if (haskey(d, :xlabel) && d[:xlabel] != "") tt, ep = titlices(d, d[:xlabel], xlabel); t *= " x+l" * tt; extra_par *= ep end
if (haskey(d, :ylabel) && d[:ylabel] != "") tt, ep = titlices(d, d[:ylabel], ylabel); t *= " y+l" * tt; extra_par *= ep end
if (haskey(d, :zlabel) && d[:zlabel] != "") tt, ep = titlices(d, d[:zlabel], zlabel); t *= " z+l" * tt; extra_par *= ep end
delete!(d, :title); delete!(d, :subtitle); delete!(d, :xlabel); delete!(d, :ylabel); delete!(d, :zlabel)# If == "" they were still there

if (t != "")
if (opt_B == "" && (val = find_in_dict(d, [:xaxis :yaxis :zaxis :xticks :yticks :zticks], false)[1] === nothing))
Expand Down Expand Up @@ -4703,7 +4704,7 @@ function interp_vec(x::AbstractVecOrMat{<:Real}, val::Real)::Float64
frac = (val - x[k]) / (x[k+1] - x[k])
return k + frac
end
function interp_vec(x::AbstractVecOrMat{<:Real}, val::VecOrMat{<:Real})
function interp_vec(x::AbstractVecOrMat{<:Real}, val::Union{VecOrMat{<:Real}, Tuple})
out = Vector{Float64}(undef, length(val))
for k = 1:numel(val)
out[k] = interp_vec(x, val[k])
Expand Down
4 changes: 2 additions & 2 deletions src/pslegend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Parameters
- **F** | **box** :: [Type => Str | Number] `Arg=[+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]]`
Without further options, draws a rectangular border around the legend using *MAP_FRAME_PEN*.
- **M** :: [Type => Bool]
- **M** | **source** :: [Type => Bool]
Modern mode only:
- **S** | **scale** :: [Type => Number]
Expand Down Expand Up @@ -55,7 +55,7 @@ function legend(cmd0::String="", arg1=nothing; first=true, kwargs...)

opt_D = parse_type_anchor(d, "", [:D :pos :position],
(map=("g", arg2str, 1), outside=("J", arg2str, 1), inside=("j", arg2str, 1), norm=("n", arg2str, 1), paper=("x", arg2str, 1), anchor=("", arg2str, 2), width=("+w", arg2str), justify="+j", spacing="+l", offset=("+o", arg2str)), 'j')
cmd = parse_these_opts(cmd, d, [[:C :clearance], [:M], [:S :scale], [:T :leg_file]])
cmd = parse_these_opts(cmd, d, [[:C :clearance], [:M :source], [:S :scale], [:T :leg_file]])

SHOW_KWARGS[1] && legend_help()
(opt_D == "") && error("The `position` argument is mandatory.")
Expand Down
Loading

0 comments on commit 1afd9eb

Please sign in to comment.