Merge d8a827b98edb002b5d7748369ec44542fe5a5c7b into 09c5e8a375dbd924347dac42a3c6067745d62276
This commit is contained in:
commit
9094e9619b
@ -371,6 +371,9 @@ const _suppress_warnings = Set{Symbol}([
|
|||||||
:x_discrete_indices,
|
:x_discrete_indices,
|
||||||
:y_discrete_indices,
|
:y_discrete_indices,
|
||||||
:z_discrete_indices,
|
:z_discrete_indices,
|
||||||
|
:x_extent_data,
|
||||||
|
:y_extent_data,
|
||||||
|
:z_extent_data,
|
||||||
:subplot,
|
:subplot,
|
||||||
:subplot_index,
|
:subplot_index,
|
||||||
:series_plotindex,
|
:series_plotindex,
|
||||||
|
|||||||
@ -318,11 +318,16 @@ function expand_extrema!(sp::Subplot, d::KW)
|
|||||||
|
|
||||||
# first expand for the data
|
# first expand for the data
|
||||||
for letter in (:x, :y, :z)
|
for letter in (:x, :y, :z)
|
||||||
data = d[if vert
|
letter_ = if vert
|
||||||
letter
|
letter
|
||||||
else
|
else
|
||||||
letter == :x ? :y : letter == :y ? :x : :z
|
letter == :x ? :y : letter == :y ? :x : :z
|
||||||
end]
|
end
|
||||||
|
|
||||||
|
extent_key = Symbol(letter_, :_extent_data)
|
||||||
|
# if there is extent_key, use it for calculating limits.
|
||||||
|
data = get(d, extent_key, d[letter_])
|
||||||
|
|
||||||
axis = sp[Symbol(letter, "axis")]
|
axis = sp[Symbol(letter, "axis")]
|
||||||
|
|
||||||
if isa(data, Volume)
|
if isa(data, Volume)
|
||||||
|
|||||||
@ -80,11 +80,14 @@ end
|
|||||||
|
|
||||||
@recipe function f(::Type{Val{:hline}}, x, y, z)
|
@recipe function f(::Type{Val{:hline}}, x, y, z)
|
||||||
xmin, xmax = hvline_limits(plotattributes[:subplot][:xaxis])
|
xmin, xmax = hvline_limits(plotattributes[:subplot][:xaxis])
|
||||||
|
span = xmax - xmin
|
||||||
n = length(y)
|
n = length(y)
|
||||||
newx = repmat(Float64[xmin, xmax, NaN], n)
|
newx = repmat(Float64[xmin-10span, xmax+10span, NaN], n)
|
||||||
newy = vec(Float64[yi for i=1:3,yi=y])
|
newy = vec(Float64[yi for i=1:3,yi=y])
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := newy
|
||||||
|
x_extent_data := Float64[]
|
||||||
|
y_extent_data := newy
|
||||||
seriestype := :path
|
seriestype := :path
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@ -92,11 +95,14 @@ end
|
|||||||
|
|
||||||
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
@recipe function f(::Type{Val{:vline}}, x, y, z)
|
||||||
ymin, ymax = hvline_limits(plotattributes[:subplot][:yaxis])
|
ymin, ymax = hvline_limits(plotattributes[:subplot][:yaxis])
|
||||||
|
span = ymax - ymin
|
||||||
n = length(y)
|
n = length(y)
|
||||||
newx = vec(Float64[yi for i=1:3,yi=y])
|
newx = vec(Float64[yi for i=1:3,yi=y])
|
||||||
newy = repmat(Float64[ymin, ymax, NaN], n)
|
newy = repmat(Float64[ymin-10span, ymax+10span, NaN], n)
|
||||||
x := newx
|
x := newx
|
||||||
y := newy
|
y := newy
|
||||||
|
x_extent_data := newx
|
||||||
|
y_extent_data := Float64[]
|
||||||
seriestype := :path
|
seriestype := :path
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@ -987,9 +993,11 @@ end
|
|||||||
|
|
||||||
"Adds a+bx... straight line over the current plot, without changing the axis limits"
|
"Adds a+bx... straight line over the current plot, without changing the axis limits"
|
||||||
function abline!(plt::Plot, a, b; kw...)
|
function abline!(plt::Plot, a, b; kw...)
|
||||||
xl, yl = xlims(plt), ylims(plt)
|
xmin, xmax = xlims(plt)
|
||||||
x1, x2 = max(xl[1], (yl[1] - b)/a), min(xl[2], (yl[2] - b)/a)
|
span = xmax - xmin
|
||||||
plot!(plt, x -> b + a*x, x1, x2; kw...)
|
xmin, xmax = (xmin - 10span, xmax + 10span)
|
||||||
|
f(x) = b + a*x
|
||||||
|
plot!(plt, [(xmin, f(xmin)), (xmax, f(xmax))]; x_extent_data = Float64[], y_extent_data = Float64[], kw...)
|
||||||
end
|
end
|
||||||
|
|
||||||
abline!(args...; kw...) = abline!(current(), args...; kw...)
|
abline!(args...; kw...) = abline!(current(), args...; kw...)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user