Merge pull request #1630 from mkborregaard/fix1.0

1.0 fixes WIP RFC
This commit is contained in:
Michael Krabbe Borregaard 2018-08-10 11:02:58 +01:00 committed by GitHub
commit 55ee64b4e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 18 deletions

View File

@ -76,7 +76,7 @@ end
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js") const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
const _plotly_js_path_remote = "https://cdn.plot.ly/plotly-latest.min.js" const _plotly_js_path_remote = "https://cdn.plot.ly/plotly-latest.min.js"
_js_code = open(readstring, _plotly_js_path, "r") _js_code = open(read, _plotly_js_path, "r")
# borrowed from https://github.com/plotly/plotly.py/blob/2594076e29584ede2d09f2aa40a8a195b3f3fc66/plotly/offline/offline.py#L64-L71 c/o @spencerlyon2 # borrowed from https://github.com/plotly/plotly.py/blob/2594076e29584ede2d09f2aa40a8a195b3f3fc66/plotly/offline/offline.py#L64-L71 c/o @spencerlyon2
_js_script = """ _js_script = """

View File

@ -523,9 +523,12 @@ mutable struct EachAnn
x x
y y
end end
Base.start(ea::EachAnn) = 1
Base.done(ea::EachAnn, i) = ea.anns == nothing || isempty(ea.anns.strs) || i > length(ea.y) function Base.iterate(ea::EachAnn, i = 1)
function Base.next(ea::EachAnn, i) if ea.anns == nothing || isempty(ea.anns.strs) || i > length(ea.y)
return nothing
end
tmp = _cycle(ea.anns.strs,i) tmp = _cycle(ea.anns.strs,i)
str,fnt = if isa(tmp, PlotText) str,fnt = if isa(tmp, PlotText)
tmp.str, tmp.font tmp.str, tmp.font

View File

@ -5,8 +5,8 @@ to_pixels(m::AbsoluteLength) = m.value / 0.254
const _cbar_width = 5mm const _cbar_width = 5mm
Base.broadcast(::typeof(Base.:.*), m::Measure, n::Number) = m * n #Base.broadcast(::typeof(Base.:.*), m::Measure, n::Number) = m * n
Base.broadcast(::typeof(Base.:.*), m::Number, n::Measure) = m * n #Base.broadcast(::typeof(Base.:.*), m::Number, n::Measure) = m * n
Base.:-(m::Measure, a::AbstractArray) = map(ai -> m - ai, a) Base.:-(m::Measure, a::AbstractArray) = map(ai -> m - ai, a)
Base.:-(a::AbstractArray, m::Measure) = map(ai -> ai - m, a) Base.:-(a::AbstractArray, m::Measure) = map(ai -> ai - m, a)
Base.zero(::Type{typeof(mm)}) = 0mm Base.zero(::Type{typeof(mm)}) = 0mm

View File

@ -185,8 +185,8 @@ function _show(io::IO, ::MIME"text/html", plt::Plot)
end end
end end
# delegate mimewritable (showable on julia 0.7) to _show instead # delegate showable to _show instead
function Base.mimewritable(m::M, plt::P) where {M<:MIME, P<:Plot} function Base.showable(m::M, plt::P) where {M<:MIME, P<:Plot}
return hasmethod(_show, Tuple{IO, M, P}) return hasmethod(_show, Tuple{IO, M, P})
end end

View File

@ -88,7 +88,7 @@ end
Base.getindex(plt::Plot, i::Integer) = plt.subplots[i] Base.getindex(plt::Plot, i::Integer) = plt.subplots[i]
Base.length(plt::Plot) = length(plt.subplots) Base.length(plt::Plot) = length(plt.subplots)
Base.endof(plt::Plot) = length(plt) Base.lastindex(plt::Plot) = length(plt)
Base.getindex(plt::Plot, r::Integer, c::Integer) = plt.layout[r,c] Base.getindex(plt::Plot, r::Integer, c::Integer) = plt.layout[r,c]
Base.size(plt::Plot) = size(plt.layout) Base.size(plt::Plot) = size(plt.layout)
@ -99,6 +99,6 @@ Base.ndims(plt::Plot) = 2
# attr!(plt::Plot, v, k::Symbol) = (plt.attr[k] = v) # attr!(plt::Plot, v, k::Symbol) = (plt.attr[k] = v)
Base.getindex(sp::Subplot, i::Integer) = series_list(sp)[i] Base.getindex(sp::Subplot, i::Integer) = series_list(sp)[i]
Base.endof(sp::Subplot) = length(series_list(sp)) Base.lastindex(sp::Subplot) = length(series_list(sp))
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------

View File

@ -215,15 +215,12 @@ anynan(i::Int, args::Tuple) = any(a -> try isnan(_cycle(a,i)) catch MethodError
anynan(istart::Int, iend::Int, args::Tuple) = any(i -> anynan(i, args), istart:iend) anynan(istart::Int, iend::Int, args::Tuple) = any(i -> anynan(i, args), istart:iend)
allnan(istart::Int, iend::Int, args::Tuple) = all(i -> anynan(i, args), istart:iend) allnan(istart::Int, iend::Int, args::Tuple) = all(i -> anynan(i, args), istart:iend)
function Base.start(itr::SegmentsIterator) function Base.iterate(itr::SegmentsIterator, nextidx::Int = 1)
nextidx = 1 nextidx > itr.n && return nothing
if !any(isempty,itr.args) && anynan(1, itr.args) if nextidx == 1 && !any(isempty,itr.args) && anynan(1, itr.args)
_, nextidx = next(itr, 1) nextidx = 2
end end
nextidx
end
Base.done(itr::SegmentsIterator, nextidx::Int) = nextidx > itr.n
function Base.next(itr::SegmentsIterator, nextidx::Int)
i = istart = iend = nextidx i = istart = iend = nextidx
# find the next NaN, and iend is the one before # find the next NaN, and iend is the one before