general axis fixes and improvemennts
This commit is contained in:
parent
18188516ec
commit
ee7a3b3686
@ -110,11 +110,11 @@ const _arg_desc = KW(
|
|||||||
:foreground_color_text => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of tick labels.",
|
:foreground_color_text => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of tick labels.",
|
||||||
:foreground_color_guide => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis guides (axis labels).",
|
:foreground_color_guide => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of axis guides (axis labels).",
|
||||||
:mirror => "Bool. Switch the side of the tick labels (right or top).",
|
:mirror => "Bool. Switch the side of the tick labels (right or top).",
|
||||||
:grid => "Bool, Symbol, String or `nothing`. Show the grid lines? `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:none`, `:off`",
|
:grid => "Bool, Symbol, String or `nothing`. Show the grid lines? `true`, `false`, `:show`, `:hide`, `:yes`, `:no`, `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:none`, `:off`",
|
||||||
:foreground_color_grid => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of grid lines.",
|
:foreground_color_grid => "Color Type or `:match` (matches `:foreground_color_subplot`). Color of grid lines.",
|
||||||
:gridalpha => "Number in [0,1]. The alpha/opacity override for the grid lines.",
|
:gridalpha => "Number in [0,1]. The alpha/opacity override for the grid lines.",
|
||||||
:gridstyle => "Symbol. Style of the grid lines. Choose from $(_allStyles)",
|
:gridstyle => "Symbol. Style of the grid lines. Choose from $(_allStyles)",
|
||||||
:gridlinewidth => "Number. Width of the grid lines (in pixels)",
|
:gridlinewidth => "Number. Width of the grid lines (in pixels)",
|
||||||
:tick_direction => "Symbol. Direction of the ticks. `:in` or `:out`",
|
:tick_direction => "Symbol. Direction of the ticks. `:in` or `:out`",
|
||||||
:showaxis => "Bool, Symbol or String. Show the axis. `true`, `false`, `:show`, `:hide`, `:yes`, `:no`, `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:none`, `:off`"
|
:showaxis => "Bool, Symbol or String. Show the axis. `true`, `false`, `:show`, `:hide`, `:yes`, `:no`, `:x`, `:y`, `:z`, `:xy`, ..., `:all`, `:off`"
|
||||||
)
|
)
|
||||||
|
|||||||
36
src/args.jl
36
src/args.jl
@ -170,8 +170,8 @@ const _scaleAliases = Dict{Symbol,Symbol}(
|
|||||||
const _allGridSyms = [:x, :y, :z,
|
const _allGridSyms = [:x, :y, :z,
|
||||||
:xy, :xz, :yx, :yz, :zx, :zy,
|
:xy, :xz, :yx, :yz, :zx, :zy,
|
||||||
:xyz, :xzy, :yxz, :yzx, :zxy, :zyx,
|
:xyz, :xzy, :yxz, :yzx, :zxy, :zyx,
|
||||||
:all, :both, :on, :yes,
|
:all, :both, :on, :yes, :show,
|
||||||
:none, :off, :no]
|
:none, :off, :no, :hide]
|
||||||
const _allGridArgs = [_allGridSyms; string.(_allGridSyms); nothing]
|
const _allGridArgs = [_allGridSyms; string.(_allGridSyms); nothing]
|
||||||
hasgrid(arg::Void, letter) = false
|
hasgrid(arg::Void, letter) = false
|
||||||
hasgrid(arg::Bool, letter) = arg
|
hasgrid(arg::Bool, letter) = arg
|
||||||
@ -188,12 +188,12 @@ hasgrid(arg::AbstractString, letter) = hasgrid(Symbol(arg), letter)
|
|||||||
const _allShowaxisSyms = [:x, :y, :z,
|
const _allShowaxisSyms = [:x, :y, :z,
|
||||||
:xy, :xz, :yx, :yz, :zx, :zy,
|
:xy, :xz, :yx, :yz, :zx, :zy,
|
||||||
:xyz, :xzy, :yxz, :yzx, :zxy, :zyx,
|
:xyz, :xzy, :yxz, :yzx, :zxy, :zyx,
|
||||||
:all, :both, :on, :yes,
|
:all, :both, :on, :yes, :show,
|
||||||
:none, :off, :no]
|
:off, :no, :hide]
|
||||||
const _allShowaxisArgs = [_allGridSyms; string.(_allGridSyms)]
|
const _allShowaxisArgs = [_allGridSyms; string.(_allGridSyms)]
|
||||||
showaxis(arg::Void, letter) = false
|
showaxis(arg::Void, letter) = false
|
||||||
showaxis(arg::Bool, letter) = arg
|
showaxis(arg::Bool, letter) = arg
|
||||||
function hasgrid(arg::Symbol, letter)
|
function showaxis(arg::Symbol, letter)
|
||||||
if arg in _allGridSyms
|
if arg in _allGridSyms
|
||||||
arg in (:all, :both, :on, :yes) || contains(string(arg), string(letter))
|
arg in (:all, :both, :on, :yes) || contains(string(arg), string(letter))
|
||||||
else
|
else
|
||||||
@ -340,7 +340,8 @@ const _axis_defaults = KW(
|
|||||||
:gridalpha => 0.1,
|
:gridalpha => 0.1,
|
||||||
:gridstyle => :solid,
|
:gridstyle => :solid,
|
||||||
:gridlinewidth => 0.5,
|
:gridlinewidth => 0.5,
|
||||||
:tick_direction => :in,
|
:tick_direction => :in,
|
||||||
|
:showaxis => true,
|
||||||
)
|
)
|
||||||
|
|
||||||
const _suppress_warnings = Set{Symbol}([
|
const _suppress_warnings = Set{Symbol}([
|
||||||
@ -728,7 +729,7 @@ function processGridArg!(d::KW, arg, letter)
|
|||||||
d[Symbol(letter, :gridlinewidth)] = arg
|
d[Symbol(letter, :gridlinewidth)] = arg
|
||||||
|
|
||||||
# color
|
# color
|
||||||
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_grid))
|
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_grid))
|
||||||
warn("Skipped grid arg $arg.")
|
warn("Skipped grid arg $arg.")
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -753,13 +754,13 @@ function preprocessArgs!(d::KW)
|
|||||||
replaceAliases!(d, _keyAliases)
|
replaceAliases!(d, _keyAliases)
|
||||||
|
|
||||||
# clear all axis stuff
|
# clear all axis stuff
|
||||||
if haskey(d, :axis) && d[:axis] in (:none, nothing, false)
|
# if haskey(d, :axis) && d[:axis] in (:none, nothing, false)
|
||||||
d[:ticks] = nothing
|
# d[:ticks] = nothing
|
||||||
d[:foreground_color_border] = RGBA(0,0,0,0)
|
# d[:foreground_color_border] = RGBA(0,0,0,0)
|
||||||
d[:foreground_color_axis] = RGBA(0,0,0,0)
|
# d[:foreground_color_axis] = RGBA(0,0,0,0)
|
||||||
d[:grid] = false
|
# d[:grid] = false
|
||||||
delete!(d, :axis)
|
# delete!(d, :axis)
|
||||||
end
|
# end
|
||||||
# for letter in (:x, :y, :z)
|
# for letter in (:x, :y, :z)
|
||||||
# asym = Symbol(letter, :axis)
|
# asym = Symbol(letter, :axis)
|
||||||
# if haskey(d, asym) || d[asym] in (:none, nothing, false)
|
# if haskey(d, asym) || d[asym] in (:none, nothing, false)
|
||||||
@ -768,6 +769,13 @@ function preprocessArgs!(d::KW)
|
|||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# handle axis args common to all axis
|
||||||
|
args = pop!(d, :axis, ())
|
||||||
|
for arg in wraptuple(args)
|
||||||
|
for letter in (:x, :y, :z)
|
||||||
|
process_axis_arg!(d, arg, letter)
|
||||||
|
end
|
||||||
|
end
|
||||||
# handle axis args
|
# handle axis args
|
||||||
for letter in (:x, :y, :z)
|
for letter in (:x, :y, :z)
|
||||||
asym = Symbol(letter, :axis)
|
asym = Symbol(letter, :axis)
|
||||||
|
|||||||
@ -70,7 +70,7 @@ function process_axis_arg!(d::KW, arg, letter = "")
|
|||||||
elseif arg == nothing
|
elseif arg == nothing
|
||||||
d[Symbol(letter,:ticks)] = []
|
d[Symbol(letter,:ticks)] = []
|
||||||
|
|
||||||
elseif arg in _allShowaxisArgs
|
elseif T <: Bool || arg in _allShowaxisArgs
|
||||||
d[Symbol(letter,:showaxis)] = showaxis(arg, letter)
|
d[Symbol(letter,:showaxis)] = showaxis(arg, letter)
|
||||||
|
|
||||||
elseif typeof(arg) <: Number
|
elseif typeof(arg) <: Number
|
||||||
@ -79,7 +79,7 @@ function process_axis_arg!(d::KW, arg, letter = "")
|
|||||||
elseif typeof(arg) <: Function
|
elseif typeof(arg) <: Function
|
||||||
d[Symbol(letter,:formatter)] = arg
|
d[Symbol(letter,:formatter)] = arg
|
||||||
|
|
||||||
else
|
elseif !handleColors!(d, arg, Symbol(letter, :foreground_color_axis))
|
||||||
warn("Skipped $(letter)axis arg $arg")
|
warn("Skipped $(letter)axis arg $arg")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user