Modified error_coords to allow errorbars in plots with categorical x-axis
This commit is contained in:
parent
2a7604ef5f
commit
62280fb24b
@ -526,8 +526,7 @@ end
|
|||||||
|
|
||||||
function error_coords(xorig, yorig, ebar)
|
function error_coords(xorig, yorig, ebar)
|
||||||
# init empty x/y, and zip errors if passed Tuple{Vector,Vector}
|
# init empty x/y, and zip errors if passed Tuple{Vector,Vector}
|
||||||
x, y = zeros(0), zeros(0)
|
x, y = Array(float_extended_type(xorig), 0), Array(Float64, 0)
|
||||||
|
|
||||||
# for each point, create a line segment from the bottom to the top of the errorbar
|
# for each point, create a line segment from the bottom to the top of the errorbar
|
||||||
for i = 1:max(length(xorig), length(yorig))
|
for i = 1:max(length(xorig), length(yorig))
|
||||||
xi = cycle(xorig, i)
|
xi = cycle(xorig, i)
|
||||||
|
|||||||
@ -228,6 +228,12 @@ function Base.next(itr::SegmentsIterator, nextidx::Int)
|
|||||||
istart:iend, i
|
istart:iend, i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Find minimal type that can contain NaN and x
|
||||||
|
# To allow use of NaN separated segments with categorical x axis
|
||||||
|
|
||||||
|
float_extended_type{T}(x::AbstractArray{T}) = Union{T,Float64}
|
||||||
|
float_extended_type{T<:Real}(x::AbstractArray{T}) = Float64
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user