allow false for color; properly expand extrema for tuple fillrange; make_fillrange_from_ribbon
This commit is contained in:
parent
4be2304ec1
commit
91ec0ad077
@ -819,7 +819,7 @@ end
|
|||||||
|
|
||||||
function color_or_nothing!(d::KW, k::Symbol)
|
function color_or_nothing!(d::KW, k::Symbol)
|
||||||
v = d[k]
|
v = d[k]
|
||||||
d[k] = if v == nothing
|
d[k] = if v == nothing || v == false
|
||||||
colorscheme(RGBA(0,0,0,0))
|
colorscheme(RGBA(0,0,0,0))
|
||||||
else
|
else
|
||||||
v
|
v
|
||||||
|
|||||||
@ -170,7 +170,14 @@ function expand_extrema!(sp::Subplot, d::KW)
|
|||||||
fr = 0.0
|
fr = 0.0
|
||||||
end
|
end
|
||||||
if fr != nothing
|
if fr != nothing
|
||||||
expand_extrema!(sp.attr[vert ? :yaxis : :xaxis], fr)
|
axis = sp.attr[vert ? :yaxis : :xaxis]
|
||||||
|
if typeof(fr) <: Tuple
|
||||||
|
for fri in fr
|
||||||
|
expand_extrema!(axis, fri)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
expand_extrema!(axis, fr)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# expand for bar_width
|
# expand for bar_width
|
||||||
|
|||||||
@ -255,8 +255,7 @@ function _plot!(plt::Plot, d::KW, args...)
|
|||||||
|
|
||||||
# convert a ribbon into a fillrange
|
# convert a ribbon into a fillrange
|
||||||
if get(kw, :ribbon, nothing) != nothing
|
if get(kw, :ribbon, nothing) != nothing
|
||||||
rib = kw[:ribbon]
|
make_fillrange_from_ribbon(kw)
|
||||||
kw[:fillrange] = (kw[:y] - rib, kw[:y] + rib)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# add the plot index
|
# add the plot index
|
||||||
|
|||||||
@ -62,9 +62,11 @@ function convertToAnyVector(v::AVec, d::KW)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
convertToAnyVector(t::Tuple, d::KW) = Any[t], nothing
|
||||||
|
|
||||||
|
|
||||||
function convertToAnyVector(args...)
|
function convertToAnyVector(args...)
|
||||||
error("No recipes could handle the argument types: $(map(typeof, args[1:end-1]))")
|
error("In convertToAnyVector, could not handle the argument types: $(map(typeof, args[1:end-1]))")
|
||||||
end
|
end
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|||||||
16
src/utils.jl
16
src/utils.jl
@ -310,7 +310,23 @@ function ok(x::Number, y::Number, z::Number = 0)
|
|||||||
end
|
end
|
||||||
ok(tup::Tuple) = ok(tup...)
|
ok(tup::Tuple) = ok(tup...)
|
||||||
|
|
||||||
|
# compute one side of a fill range from a ribbon
|
||||||
|
function make_fillrange_side(y, rib)
|
||||||
|
frs = zeros(length(y))
|
||||||
|
for (i, (yi, ri)) in enumerate(zip(y, cycle(rib)))
|
||||||
|
frs[i] = yi + ri
|
||||||
|
end
|
||||||
|
frs
|
||||||
|
end
|
||||||
|
|
||||||
|
# turn a ribbon into a fillrange
|
||||||
|
function make_fillrange_from_ribbon(kw::KW)
|
||||||
|
y, rib = kw[:y], kw[:ribbon]
|
||||||
|
rib = wraptuple(rib)
|
||||||
|
rib1, rib2 = -first(rib), last(rib)
|
||||||
|
kw[:ribbon] = nothing
|
||||||
|
kw[:fillrange] = make_fillrange_side(y, rib1), make_fillrange_side(y, rib2)
|
||||||
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user