diff --git a/NEWS.md b/NEWS.md index 930df8b0..10378f0f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,7 +10,14 @@ --- ## (current master) -- All new development should target Julia 0.7! +- All new development should target Julia 1.x! + +## 0.19.0 +- Refactor conditional loading to use Requires +- Many fixes for 1.0 compatibility + +## 0.18.0 +- update minor version to 0.7 ## 0.17.4 - fix thickness_scaling for pyplot diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 06407929..afccd2e6 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -21,7 +21,7 @@ const _arg_desc = KW( :markerstrokewidth => "Number. Width of the marker stroke (border. in pixels)", :markerstrokecolor => "Color Type. Color of the marker stroke (border). `:match` will take the value from `:foreground_color_subplot`.", :markerstrokealpha => "Number in [0,1]. The alpha/opacity override for the marker stroke (border). `nothing` (the default) means it will take the alpha value of markerstrokecolor.", -:bins => "Integer, NTuple{2,Integer}, AbstractVector or Symbol. Default is :auto (the Freedman-Diaconis rule). For histogram-types, defines the approximate number of bins to aim for, or the auto-binning algorithm to use (:sturges, :sqrt, :rice, :scott or :fd). For fine-grained control pass a Vector of break values, e.g. `linspace(extrema(x)..., 25)`", +:bins => "Integer, NTuple{2,Integer}, AbstractVector or Symbol. Default is :auto (the Freedman-Diaconis rule). For histogram-types, defines the approximate number of bins to aim for, or the auto-binning algorithm to use (:sturges, :sqrt, :rice, :scott or :fd). For fine-grained control pass a Vector of break values, e.g. `range(min(x), stop = extrema(x), length = 25)`", :smooth => "Bool. Add a regression line?", :group => "AbstractVector. Data is split into a separate series, one for each unique value in `group`.", :x => "Various. Input data. First Dimension", diff --git a/src/backends/hdf5.jl b/src/backends/hdf5.jl index d8919942..2c6b3ecb 100644 --- a/src/backends/hdf5.jl +++ b/src/backends/hdf5.jl @@ -270,7 +270,7 @@ function _hdf5plot_writecount(grp, n::Int) #Write directly to group end function _hdf5plot_gwritefields(grp, k::String, v) grp = HDF5.g_create(grp, k) - for _k in fieldnames(v) + for _k in fieldnames(typeof(v)) _v = getfield(v, _k) kstr = string(_k) _hdf5plot_gwrite(grp, kstr, _v) diff --git a/src/deprecated/colors.jl b/src/deprecated/colors.jl index 4646934a..5e01bdc1 100644 --- a/src/deprecated/colors.jl +++ b/src/deprecated/colors.jl @@ -120,7 +120,7 @@ struct ColorGradient <: ColorScheme # # otherwise interpolate evenly between the minval and maxval # minval, maxval = minimum(vals), maximum(vals) - # vs = Float64[interpolate(minval, maxval, w) for w in linspace(0, 1, length(cs))] + # vs = Float64[interpolate(minval, maxval, w) for w in range(0, stop = 1, length = length(cs))] # new(convertColor(cs,alpha), vs) # interpolate the colors for each value @@ -147,7 +147,7 @@ function ColorGradient(s::Symbol, vals::AVec{T} = 0:0; kw...) where T<:Real ColorGradient(cs, vals; kw...) end -# function ColorGradient{T<:Real}(cs::AVec, vals::AVec{T} = linspace(0, 1, length(cs)); kw...) +# function ColorGradient{T<:Real}(cs::AVec, vals::AVec{T} = range(0, stop = 1, length = length(cs)); kw...) # ColorGradient(map(convertColor, cs), vals; kw...) # end diff --git a/src/recipes.jl b/src/recipes.jl index 26796657..be27cdd4 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -284,7 +284,7 @@ end # where the points are the control points of the curve for rng in iter_segments(args...) length(rng) < 2 && continue - ts = linspace(0, 1, npoints) + ts = range(0, stop = 1, length = npoints) nanappend!(newx, map(t -> bezier_value(_cycle(x,rng), t), ts)) nanappend!(newy, map(t -> bezier_value(_cycle(y,rng), t), ts)) if z != nothing @@ -498,21 +498,25 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S log_scale_x = xscale in _logScales log_scale_y = yscale in _logScales - nbins = length(linearindices(weights)) - if length(linearindices(edge)) != nbins + 1 + nbins = length(eachindex(weights)) + if length(eachindex(edge)) != nbins + 1 error("Edge vector must be 1 longer than weight vector") end x = eltype(edge)[] y = eltype(weights)[] - it_e, it_w = start(edge), start(weights) - a, it_e = next(edge, it_e) + it_tuple_e = iterate(edge) + a, it_state_e = it_tuple_e + it_tuple_e = iterate(edge, it_state_e) + + it_tuple_w = iterate(weights) + last_w = eltype(weights)(NaN) - i = 1 - while (!done(edge, it_e) && !done(edge, it_e)) - b, it_e = next(edge, it_e) - w, it_w = next(weights, it_w) + + while it_tuple_e != nothing && it_tuple_w != nothing + b, it_state_e = it_tuple_e + w, it_state_w = it_tuple_w if (log_scale_x && a ≈ 0) a = b/_logScaleBases[xscale]^3 @@ -536,6 +540,9 @@ function _stepbins_path(edge, weights, baseline::Real, xscale::Symbol, yscale::S a = b last_w = w + + it_tuple_e = iterate(edge, it_state_e) + it_tuple_w = iterate(weights, it_state_w) end if (last_w != baseline) push!(x, a) diff --git a/src/series.jl b/src/series.jl index ff55801b..70ec5f0d 100644 --- a/src/series.jl +++ b/src/series.jl @@ -518,7 +518,7 @@ end xs, fs end @recipe f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, u::AVec) where {F<:Function,G<:Function} = mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u) -@recipe f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, umin::Number, umax::Number, n = 200) where {F<:Function,G<:Function} = fx, fy, linspace(umin, umax, n) +@recipe f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, umin::Number, umax::Number, n = 200) where {F<:Function,G<:Function} = fx, fy, range(umin, stop = umax, length = n) # # # special handling... 3D parametric function(s) @@ -526,7 +526,7 @@ end mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u) end @recipe function f(fx::FuncOrFuncs{F}, fy::FuncOrFuncs{G}, fz::FuncOrFuncs{H}, umin::Number, umax::Number, numPoints = 200) where {F<:Function,G<:Function,H<:Function} - fx, fy, fz, linspace(umin, umax, numPoints) + fx, fy, fz, range(umin, stop = umax, length = numPoints) end # diff --git a/src/themes.jl b/src/themes.jl index 5d1c032f..da313498 100644 --- a/src/themes.jl +++ b/src/themes.jl @@ -10,7 +10,7 @@ end function _get_defaults(s::Symbol) thm = PlotThemes._themes[s] - if :defaults in fieldnames(thm) + if :defaults in fieldnames(typeof(thm)) return thm.defaults else # old PlotTheme type defaults = KW( @@ -132,7 +132,7 @@ _get_showtheme_args(thm::Symbol, func::Symbol) = thm, get(_color_functions, func f(r) = sin(r) / r _norm(x, y) = norm([x, y]) - x = y = linspace(-3π, 3π, 30) + x = y = range(-3π, stop = 3π, length = 30) z = f.(_norm.(x, y')) wi = 2:3:30 @@ -152,7 +152,7 @@ _get_showtheme_args(thm::Symbol, func::Symbol) = thm, get(_color_functions, func end n = 100 - ts = linspace(0, 10π, n) + ts = range(0, stop = 10π, length = n) x = ts .* cos.(ts) y = (0.1ts) .* sin.(ts) z = 1:n