Skip to content
8 changes: 5 additions & 3 deletions src/GMT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ const DEF_FIG_AXES_BAK = " -Baf -BWSen" # Default fig axes for plot l
const DEF_FIG_AXES3_BAK = " -Baf -Bza" # "" but for 3D views
const global DEF_FIG_AXES = [DEF_FIG_AXES_BAK] # This one may be be changed by theme()
const global DEF_FIG_AXES3 = [DEF_FIG_AXES3_BAK] # ""
const global FIG_MARGIN = [1] # Figure margin in points after convertion by 'psconvert'
const global PSCONV_PAR = [" -Qg4 -Qt4 "] # In showfig() both are combined to get (default) " -A1p -Qg4 -Qt4 "
const global FIG_MARGIN = [1] # Figure margin in points after convertion by 'psconvert'. Accessible 'margin' common option
const global CTRL = CTRLstruct(zeros(13), zeros(6), [true], [false],
[:arrows, :bubblechart, :basemap, :band, :clip, :coast, :colorbar, :hband, :hlines, :inset, :logo, :lines, :grdvector, :plot, :plot3, :quiver, :scatter, :scatter3, :stairs, :text, :vlines, :vband], fill(nothing, 6), ["","",""], ["","", "", " "], ["",""], ["",""], [false,true], [C_NULL], [Dict()])
const global CTRLshapes = CTRLstruct2([true], [true], [""]) # Used in sub-module Drawing
Expand Down Expand Up @@ -186,7 +185,8 @@ export

lazinfo, lazread, lazwrite, lasread, laswrite,

cube, cylinder, dodecahedron, ellipse3D, icosahedron, sphere, octahedron, tetrahedron, torus, replicant, loft, revolve,
cube, cylinder, circlepts, dodecahedron, ellipse3D, eulermat, icosahedron, loft, sphere, spinmat, octahedron,
tetrahedron, torus, replicant, revolve, rotate, rotate!, translate, translate!,

df2ds, ds2df, extrude, fv2fv, isclockwise, surf2fv, ODE2ds,
@?, @dir
Expand Down Expand Up @@ -343,6 +343,8 @@ using GMT.Laszip
GMT.parse_B(Dict(:frame => (annot=10, title="Ai Ai"), :grid => (pen=2, x=10, y=20)), "", " -Baf -BWSen");
GMT.parse_R(Dict(:xlim => (1,2), :ylim => (3,4), :zlim => (5,6)), "");
GMT.parse_J(Dict(:J => "X", :scale => "1:10"), "");
#GMT.parse_opt_S(Dict(:size => [1 2]), rand(4));
GMT.parse_opt_S(Dict{String, Any}(), mat2ds(rand(4,2)));
GMT.build_opt_J(:X5);
GMT.theme("dark")
GMT.theme_modern()
Expand Down
25 changes: 19 additions & 6 deletions src/common_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,17 @@ function GMTsyntax_opt(d::Dict, cmd::String, del::Bool=true)::Tuple{String, Stri
end

# ---------------------------------------------------------------------------------------------------
"""
parse_paper(d::Dict) -> Nothing

Move to paper coordinates.

If user sets the 'paper' option, move to paper coordinates. By default we set a background
canvas of 2x2 m. But for tuning it may be useful to plot a grid. For that use 'paper=:grid'
Other option is to set the units to inches. For it use 'paper=:inch'
If both inches and grid is intended use 'paper=(:inch,:grid)'
"""
function parse_paper(d::Dict)
# If user set the 'paper' option, move to paper coordinates. By default set a background
# canvas of 2x2 m. But for tuning it may be useful to plot a grid. For that use 'paper=:grid'
# Other option is to set the units to inches. For it use 'paper=:inch'
# If both inches and grid is intended use 'paper=(:inch,:grid)'
((val = find_in_dict(d, [:paper])[1]) === nothing) && return nothing

opt_J::String, opt_B::String, opt_R::String = " -Jx1c", "", " -R0/200/0/200"
Expand All @@ -130,8 +136,13 @@ function parse_paper(d::Dict)
CTRL.IamInPaperMode[1] = true
return nothing
end
# ---------------------------------------------------------------------------------------------------
"""
leave_paper_mode() -> Nothing

Reset the -R -J previous to the paper mode setting
"""
function leave_paper_mode()
# Reset the -R -J previous to the paper mode setting
!CTRL.IamInPaperMode[1] && return nothing
t::String = IamModern[1] ? "" : " -O -K >> " * PSname[1]::String
CTRL.IamInPaperMode[1] && gmt("psxy -T " * CTRL.pocket_R[1] * CTRL.pocket_J[1] * CTRL.pocket_J[3] * t)
Expand Down Expand Up @@ -1675,6 +1686,7 @@ function parse_common_opts(d::Dict, cmd::String, opts::VMs; first::Bool=true, is
elseif (opt == :F) cmd = parse_F(d, cmd)
elseif (opt == :UVXY) cmd = parse_UVXY(d, cmd)
elseif (opt == :V_params) cmd = parse_V_params(d, cmd)
elseif (opt == :margin && haskey(d, :margin)) FIG_MARGIN[1] = d[:margin]; delete!(d, :margin)
elseif (opt == :a) cmd, o = parse_a(d, cmd)
elseif (opt == :b) cmd, o = parse_b(d, cmd)
elseif (opt == :c) cmd, o = parse_c(d, cmd)
Expand Down Expand Up @@ -4188,7 +4200,8 @@ function showfig(d::Dict, fname_ps::String, fname_ext::String, opt_T::String, K:
opt_T = " -Tg"; fname_ext = "png" # In Jupyter or Pluto, png only
end

pscvt_cmd = "psconvert -A$(FIG_MARGIN[1])p" * PSCONV_PAR[1] # The default is "psconvert -A1p -Qg4 -Qt4 "
pscvt_cmd = "psconvert -A$(FIG_MARGIN[1])p" * " -Qg4 -Qt4 " # The default is "psconvert -A1p -Qg4 -Qt4 "
(FIG_MARGIN[1] != 1) && (FIG_MARGIN[1] = 1) # Reset the default
if (fname_ps != "" && isPluto) # A patch attempt to an undebugable Pluto thing
(K) && close_PS_file(fname_ps) # Close the PS file first
gmt(pscvt_cmd * fname_ps * " -Tg *")
Expand Down
15 changes: 13 additions & 2 deletions src/gmt_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,34 @@ The fields of this struct are:
- `bbox`::Vector{Float64} The vertices BoundingBox
- `zscale`::Float64 A multiplicative factor to scale the z values
- `bfculling`::Bool If culling of invisible faces is wished
- `isflat`::Bool If this is a flat mesh
- `proj4::String` Projection string in PROJ4 syntax (Optional)
- `wkt::String` Projection string in WKT syntax (Optional)
- `epsg::Int` EPSG projection code (Optional)
"""
Base.@kwdef mutable struct GMTfv{T<:AbstractFloat} <: AbstractMatrix{T}
Base.@kwdef mutable struct GMTfv{T<:AbstractFloat} <: AbstractArray{T,2}
verts::AbstractMatrix{T}=Matrix{Float64}(undef,0,0)
faces::Vector{<:AbstractMatrix{<:Integer}}=Vector{Matrix{Int}}(undef,0)
faces_view::Vector{Matrix{Int}}=Vector{Matrix{Int}}(undef,0)
color::Vector{Vector{String}}=[String[]]
bbox::Vector{Float64}=zeros(6)
zscale::Float64=1.0
bfculling::Bool=true
isflat::Bool=false
proj4::String=""
wkt::String=""
epsg::Int=0
end
Base.size(FV::GMTfv) = sum(size.(FV.faces))
Base.size(FV::GMTfv) = size(FV.verts)
Base.getindex(FV::GMTfv{T}, inds::Vararg{Int}) where {T} = FV.verts[inds...]
Base.setindex!(FV::GMTfv{T}, val, inds::Vararg{Int}) where {T} = FV.verts[inds...] = val
Base.BroadcastStyle(::Type{<:GMTfv}) = Broadcast.ArrayStyle{GMTfv}()
function Base.similar(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{GMTfv}}, ::Type{ElType}) where ElType
FV = find4similar(bc.args) # Scan the inputs for the FV:
#GMTfv(similar(Array{ElType}, axes(bc)), FV.faces, FV.faces_view, FV.color, FV.bbox, FV.zscale, FV.bfculling, FV.proj4, FV.wkt, FV.epsg)
GMTfv(FV.verts, FV.faces, FV.faces_view, FV.color, FV.bbox, FV.zscale, FV.bfculling, FV.proj4, FV.wkt, FV.epsg)
end
find4similar(FV::GMTfv, rest) = FV

#=
Base.@kwdef struct GMTtypes
Expand Down
56 changes: 56 additions & 0 deletions src/grd_operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,59 @@ flipud(G::GMTgrid) = GMTgrid(G.proj4, G.wkt, G.epsg, G.geog, G.range, G.inc, G.r
fliplr(G::GMTgrid) = GMTgrid(G.proj4, G.wkt, G.epsg, G.geog, G.range, G.inc, G.registration, G.nodata, G.title, G.remark, G.command, G.cpt, G.names, G.x, G.y, G.v, fliplr(G.z), G.x_unit, G.y_unit, G.v_unit, G.z_unit, G.layout, G.scale, G.offset, G.pad, G.hasnans)
flipud(I::GMTimage) = GMTimage(I.proj4, I.wkt, I.epsg, I.geog, I.range, I.inc, I.registration, I.nodata, I.color_interp, I.metadata, I.names, I.x, I.y, I.v, flipud(I.image), I.colormap, I.labels, I.n_colors, flipud(I.alpha), I.layout, I.pad)
fliplr(I::GMTimage) = GMTimage(I.proj4, I.wkt, I.epsg, I.geog, I.range, I.inc, I.registration, I.nodata, I.color_interp, I.metadata, I.names, I.x, I.y, I.v, fliplr(I.image), I.colormap, I.labels, I.n_colors, fliplr(I.alpha), I.layout, I.pad)

# ---------------------------------------------------------------------------------------------------
"""
FV = rotate(FV::GMTfv, a=Float64[]; rx=0.0, ry=0.0, rz=0.0) -> GMTfv

Rotate the FacesVertices `FV` by the Euler angles (in degrees) `rx`, `ry` and `rz`.

The _insitu_ version `rotate!()` does it in-place.
Note: We set the `bfculling` value to false because after rotations surfaces are not guaranteed to be CCW.

### Args
- `FV::GMTfv`: FacesVertices object
- `a=[rx, ry, rz]`: Euler angles (in degrees) about the x, y and z axes.

### Kwargs
- `rx, ry, rz`: Alternative to `a`, provide one to three of those Euler angles.

"""
function rotate(FV::GMTfv, a=Float64[]; rx=0.0, ry=0.0, rz=0.0, insitu::Bool=false)
!isempty(a) && (@assert length(a) == 3 "Angle vector must be of length 3")
isempty(a) && (a = [rx, ry, rz])
V = FV.verts * eulermat(a)[1]
mimas = extrema(V, dims=1)
bbox = [mimas[1][1], mimas[1][2], mimas[2][1], mimas[2][2], mimas[3][1], mimas[3][2]] # So stu..
if insitu
FV.verts, FV.bfculling = V, false
FV.bbox = bbox
return FV
end
GMTfv(verts=V, faces=copy(FV.faces), color=copy(FV.color), bbox=bbox, zscale=FV.zscale, bfculling=false, isflat=FV.isflat)
end
rotate!(FV::GMTfv, a=Float64[]; rx=0.0, ry=0.0, rz=0.0) = rotate(FV, a; rx=rx, ry=ry, rz=rz, insitu=true)

# ---------------------------------------------------------------------------------------------------
"""
FV = translate(FV::GMTfv; dx=0.0, dy=0.0, dz=0.0) -> GMTfv

Translate the FacesVertices object by dx, dy and dz.

The _insitu_ version `translate!()` does it in-place.

### Args
- `FV::GMTfv`: FacesVertices object

### Kwargs
- `dx, dy, dz`: The amount of offset to apply to the x, y and z FV.verts components.
"""
function translate(FV::GMTfv; dx=0.0, dy=0.0, dz=0.0, insitu::Bool=false)
!insitu && (FV = deepcopy(FV))
(dx != 0) && (view(FV.verts, :, 1) .+= dx)
(dy != 0) && (view(FV.verts, :, 2) .+= dy)
(dz != 0) && (view(FV.verts, :, 3) .+= dz)
FV.bbox += [dx, dx, dy, dy, dz, dz]
return FV
end
translate!(FV::GMTfv; dx=0.0, dy=0.0, dz=0.0) = translate(FV; dx=dx, dy=dy, dz=dz, insitu=true)
2 changes: 1 addition & 1 deletion src/grdcontour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function grdcontour_helper(cmd0::String, arg1; first=true, kw...)
dict_auto_add!(d) # The ternary module may send options via another channel

cmd::String, opt_B, opt_J, opt_R = parse_BJR(d, "", "", O, " -JX" * split(DEF_FIG_SIZE, '/')[1] * "/0")
cmd, = parse_common_opts(d, cmd, [:UVXY :params :bo :c :e :f :h :p :t]; first=first)
cmd, = parse_common_opts(d, cmd, [:UVXY :margin :params :bo :c :e :f :h :p :t]; first=first)
cmd = parse_these_opts(cmd, d, [[:D :dump], [:F :force], [:L :range], [:Q :cut], [:S :smooth]])
cmd = parse_contour_AGTW(d::Dict, cmd::String)[1]
cmd = add_opt(d, cmd, "Z", [:Z :muladd :scale], (factor = "+s", shift = "+o", periodic = "_+p"))
Expand Down
2 changes: 1 addition & 1 deletion src/grdimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function grdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; fir
(!has_opt_B && isa(arg1, GMTimage) && (isimgsize(arg1) || CTRL.limits[1:4] == zeros(4)) && opt_B == DEF_FIG_AXES_BAK) &&
(cmd = replace(cmd, opt_B => "")) # Dont plot axes for plain images if that was not required

cmd, = parse_common_opts(d, cmd, [:UVXY :params :c :f :n :p :t]; first=first)
cmd, = parse_common_opts(d, cmd, [:UVXY :params :margin :c :f :n :p :t]; first=first)
cmd = parse_these_opts(cmd, d, [[:A :img_out :image_out], [:D :img_in :image_in], [:E :dpi], [:G :bit_color],
[:M :monochrome], [:N :noclip], [:Q :nan_alpha :alpha_color]])
cmd = add_opt(d, cmd, "%", [:layout :mem_layout], nothing)
Expand Down
2 changes: 1 addition & 1 deletion src/grdvector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function grdvector(arg1, arg2; first=true, kwargs...)
DEF_FIG_AXES_::String = (IamModern[1]) ? "" : DEF_FIG_AXES[1] # DEF_FIG_AXES is a global const
cmd, opt_B = parse_B(d, cmd, (O ? "" : DEF_FIG_AXES_))

cmd = parse_common_opts(d, cmd, [:UVXY :f :p :t :params]; first=first)[1]
cmd = parse_common_opts(d, cmd, [:UVXY :f :p :t :margin :params]; first=first)[1]
!(contains(cmd, "-V")) && (cmd *= " -Ve") # Shut up annoying warnings if -S has no units
cmd = parse_these_opts(cmd, d, [[:A :polar], [:N :noclip :no_clip], [:T :sign_scale], [:Z :azimuth]])
opt_S = add_opt(d, "", "S", [:S :vscale :vec_scale],
Expand Down
2 changes: 1 addition & 1 deletion src/grdview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function grdview_helper(cmd0::String, arg1; first=true, kwargs...)
(!have_opt_B && isa(arg1, GMTimage) && (isimgsize(arg1) || CTRL.limits[1:4] == zeros(4)) && opt_B == DEF_FIG_AXES_BAK) &&
(cmd = replace(cmd, opt_B => "")) # Dont plot axes for plain images if that was not required

cmd, = parse_common_opts(d, cmd, [:UVXY :c :f :n :p :t :params]; first=first)
cmd, = parse_common_opts(d, cmd, [:UVXY :margin :c :f :n :p :t :params]; first=first)
!first && !contains(cmd, " -p") && (cmd *= CURRENT_VIEW[1]) # Inherit current view
cmd = add_opt(d, cmd, "S", [:S :smooth])
if ((val = find_in_dict(d, [:N :plane])[1]) !== nothing)
Expand Down
16 changes: 8 additions & 8 deletions src/imgtiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ function mosaic(lon::Vector{<:Float64}, lat::Vector{<:Float64}; pt_radius=637813
# ---------------------- Case when rectangle BB was given
if (length(lon) == 2) # See if have other tiles in between the ones deffined by lon_min and lon_max
Dtile = xmm[2, 1] - xmm[1, 2] # > 0, have tiles in the midle; == 0, two contiguous tiles; < 0, same tile
nInTilesX = Dtile > 0 ? Dtile / 256 : Dtile == 0 ? 0 : -1
nInTilesX = Dtile > 0 ? Int(Dtile / 256) : Dtile == 0 ? 0 : -1

Dtile = ymm[2, 1] - ymm[1, 2] # Idem for lat
nInTilesY = Dtile > 0 ? Dtile / 256 : Dtile == 0 ? 0 : -1
nInTilesY = Dtile > 0 ? Int(Dtile / 256) : Dtile == 0 ? 0 : -1
neighbors = ones(Int(nInTilesY)+2, Int(nInTilesX)+2) # Create the neighbors matrix

lon_mm = [minimum(lon_mm), maximum(lon_mm)]
Expand Down Expand Up @@ -429,16 +429,16 @@ function mosaic(lon::Vector{<:Float64}, lat::Vector{<:Float64}; pt_radius=637813

xx = collect(linspace(xm[1], xm[2], size(img,1)+1))
yy = collect(linspace(ym[1], ym[2], size(img,2)+1))
I::GMTimage = mat2img(img, x=xx, y=yy, proj4="+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=$pt_radius +b=$pt_radius +units=m +no_defs", layout="TRBa", is_transposed=true)
@assert typeof(I) === GMTimage{UInt8, 3} # Fck compiler. Only this convinced it to make I type stable
I::GMTimage{UInt8, 3} = mat2img(img, x=xx, y=yy, proj4="+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=$pt_radius +b=$pt_radius +units=m +no_defs", layout="TRBa", is_transposed=true)
@assert typeof(I) === GMTimage{UInt8, 3} # Fck compiler. Not even this convinced it to make I type stable

if (inMerc && isExact) # Cut to the exact required limits
mat::Matrix{Float64} = mapproject([lon[1] lat_orig[1]; lon[2] lat_orig[2]], J=I.proj4).data
I = grdcut(I, R=(mat[1,1], mat[2,1], mat[1,2], mat[2,2]))::GMTimage
I = grdcut(I, R=(mat[1,1], mat[2,1], mat[1,2], mat[2,2]))::GMTimage{UInt8, 3}
elseif (!inMerc) # That is, if project to Geogs
gdwopts = ["-t_srs","+proj=latlong +datum=WGS84", "-r","cubic"]
isExact && append!(gdwopts, ["-te"], ["$(lon[1])"], ["$(lat_orig[1])"], ["$(lon[2])"], ["$(lat_orig[2])"])
I = gdalwarp(I, gdwopts)::GMTimage
I = gdalwarp(I, gdwopts)::GMTimage{UInt8, 3}
end

return I
Expand Down Expand Up @@ -951,7 +951,7 @@ useful to use in the `mosaic` program. For that purpose, the returned BB is sore
### Example
geocoder("Paris, France")
"""
function geocoder(address::String; options=String[])
function geocoder(address::String; options=String[])::GDtype
# Get the geocoder info for a given address. Adapted from https://www.itopen.it/geocoding-with-gdal/

_ops = isempty(options) ? C_NULL : options # The default is ["SERVICE", "OSM_NOMINATIM"]
Expand All @@ -970,7 +970,7 @@ function geocoder(address::String; options=String[])
BB = parse.(Float64, split(dic["boundingbox"], ","))
GMT.Gdal.OGRGeocodeFreeResult(hLayer)
GMT.Gdal.OGRGeocodeDestroySession(hSession)
D = mat2ds([parse(Float64, dic["lon"]) parse(Float64, dic["lat"])], attrib=dic, proj4=prj4WGS84, geom=wkbPoint)
D::GDtype = mat2ds([parse(Float64, dic["lon"]) parse(Float64, dic["lat"])], attrib=dic, proj4=prj4WGS84, geom=wkbPoint)
D.ds_bbox = [BB[3], BB[4], BB[1], BB[2]]
return D
end
Expand Down
2 changes: 1 addition & 1 deletion src/psbasemap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function basemap(; first=true, kwargs...)

cmd, = parse_BJR(d, "", "", O, " -JX" * split(DEF_FIG_SIZE, '/')[1] * "/0")
cmd, = parse_JZ(d, cmd)
cmd, = parse_common_opts(d, cmd, [:F :UVXY :bo :c :f :p :t :params]; first=first)
cmd, = parse_common_opts(d, cmd, [:F :UVXY :bo :c :f :p :t :params :margin]; first=first)
cmd = parse_these_opts(cmd, d, [[:A :polygon]])
cmd = parse_Td(d, cmd)
cmd = parse_Tm(d, cmd)
Expand Down
2 changes: 1 addition & 1 deletion src/pscoast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function coast(cmd0::String=""; clip=nothing, first=true, kwargs...)
cmd = parse_B(d, cmd, (O ? "" : (IamModern[1]) ? "" : DEF_FIG_AXES[1]))[1]
end
end
common = have_opt_M ? [:UVXY :bo :params] : [:F :JZ :UVXY :bo :c :p :t :params]
common = have_opt_M ? [:UVXY :bo :params] : [:F :JZ :UVXY :bo :c :p :t :params :margin]
cmd, = parse_common_opts(d, cmd, common; first=first) # If -M don't touch -p
cmd = parse_these_opts(cmd, d, [[:A :area], [:C :river_fill], [:D :res :resolution]])
cmd = parse_Td(d, cmd)
Expand Down
2 changes: 1 addition & 1 deletion src/pscontour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function contour_helper(cmd0::String, arg1; first=true, kwargs...)
dict_auto_add!(d) # The ternary module may send options via another channel

cmd, _, _, opt_R = parse_BJR(d, "", "", O, " -JX" * split(DEF_FIG_SIZE, '/')[1] * "/0")
cmd, = parse_common_opts(d, cmd, [:UVXY :bo :c :d :do :e :p :t :params]; first=first)
cmd, = parse_common_opts(d, cmd, [:UVXY :bo :c :d :do :e :p :t :params :margin]; first=first)
cmd = parse_these_opts(cmd, d, [[:D :dump], [:I :fill :colorize], [:N :no_clip], [:Q :cut], [:S :skip]])
cmd *= add_opt_pen(d, [:L :mesh], "L")
cmd, opt_W = parse_contour_AGTW(d, cmd)
Expand Down
2 changes: 1 addition & 1 deletion src/pshistogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function histogram_helper(cmd0::String, arg1; first=true, kwargs...)

cmd, opt_B, opt_J, opt_R ::String= parse_BJR(d, cmd, "histogram", O, " -JX14c/14c")
cmd = parse_JZ(d, cmd)[1]
cmd = parse_common_opts(d, cmd, [:UVXY :JZ :c :e :f :p :t :w :params]; first=first)[1]
cmd = parse_common_opts(d, cmd, [:UVXY :JZ :c :e :f :p :t :w :params :margin]; first=first)[1]
cmd = parse_these_opts(cmd, d, [[:A :horizontal], [:F :center], [:Q :cumulative], [:S :stairs]])
nofill = ((symb = is_in_dict(d, [:G :fill])) !== nothing && d[symb] == "") ? true : false # To know if no fill was asked
cmd = add_opt_fill(cmd, d, [:G :fill], 'G')
Expand Down
2 changes: 1 addition & 1 deletion src/psimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function image_helper(cmd0::String, arg1; first=true, kwargs...)
d, K, O = init_module(first, kwargs...) # Also checks if the user wants ONLY the HELP mode

cmd = parse_BJR(d, "", "", O, " -JX" * split(DEF_FIG_SIZE, '/')[1] * "/0")[1]
cmd = parse_common_opts(d, cmd, [:F :UVXY :JZ :c :p :t :params]; first=first)[1]
cmd = parse_common_opts(d, cmd, [:F :UVXY :JZ :c :p :t :params :margin]; first=first)[1]
cmd = parse_these_opts(cmd, d, [[:I :invert], [:M :monochrome]])
((val = find_in_dict(d, [:G :bitcolor :bit_color])[1]) !== nothing && isa(val, String)) && (cmd *= string(" -G", val))
((val = find_in_dict(d, [:bit_bg])[1]) !== nothing) && (cmd = add_opt_fill(val, cmd, " -G") * "+b")
Expand Down
2 changes: 1 addition & 1 deletion src/psrose.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function rose_helper(cmd0::String, arg1; first=true, kwargs...)
end

cmd, opt_B, opt_J, opt_R = parse_BJR(d, "", "", O, " -JX12c")
cmd, = parse_common_opts(d, cmd, [:UVXY :c :e :p :t :w :params]; first=first)
cmd, = parse_common_opts(d, cmd, [:UVXY :c :e :p :t :w :margin :params]; first=first)
cmd = parse_these_opts(cmd, d, [[:D :shift], [:F :no_scale], [:L :labels], [:M :vector_params], [:N :vonmises],
[:Q :alpha], [:S :norm :normalize], [:T :orientation], [:Z :scale]])
cmd = add_opt(d, cmd, "A", [:A :sector :sectors], (width="", rose="_+r"))
Expand Down
2 changes: 1 addition & 1 deletion src/psscale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function colorbar(arg1::Union{Nothing, GMTcpt}=nothing; first=true, kwargs...)
cmd = parse_BJR(d, "", "", O, "")[1]
opt_B = (!contains(cmd, " -B") && !IamModern[1]) ? DEF_FIG_AXES[1] : ""
cmd = parse_JZ(d, cmd; O=O, is3D=(CTRL.pocket_J[3] != ""))[1] # We can't use parse_J(d)[1]
cmd = parse_common_opts(d, cmd, [:F :UVXY :params :c :p :t]; first=first)[1]
cmd = parse_common_opts(d, cmd, [:F :UVXY :params :margin :c :p :t]; first=first)[1]
cmd = parse_these_opts(cmd, d, [[:G :truncate], [:I :shade], [:M :monochrome], [:N :dpi],
[:Q :log], [:S :appearance :nolines], [:W :scale], [:Z :zfile]])
opt_D = parse_type_anchor(d, "", [:D :pos :position],
Expand Down
Loading
Loading