replace deprecated linspace; another tweak to CI stuff

This commit is contained in:
Ralph A. Smith 2018-06-29 23:40:34 -04:00
parent 48bfe523b8
commit 9e4c7ee78f
13 changed files with 27 additions and 30 deletions

View File

@ -2,7 +2,7 @@
language: julia language: julia
os: os:
- linux - linux
# - osx - osx
julia: julia:
# - 0.7 # - 0.7
- nightly - nightly

View File

@ -1,13 +1,10 @@
environment: environment:
matrix: matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
matrix: matrix:
allow_failures: allow_failures:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe" #check and address
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe" - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
@ -32,8 +29,8 @@ install:
build_script: build_script:
# Need to convert from shallow to complete for Pkg.clone to work # Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow) - IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo(); Pkg.clone(pwd(), \"Plots\"); Pkg.build(\"Plots\")" - C:\projects\julia\bin\julia -e "using InteractiveUtils; versioninfo(); import Pkg; Pkg.clone(pwd(),\"Plots\"); Pkg.build(\"Plots\")"
test_script: test_script:
# - C:\projects\julia\bin\julia -e "Pkg.test(\"Plots\")" # - C:\projects\julia\bin\julia -e "Pkg.test(\"Plots\")"
- C:\projects\julia\bin\julia -e "include(Pkg.dir(\"Plots\", \"test\", \"travis_commands.jl\"))" - C:\projects\julia\bin\julia -e "import Pkg; include(Pkg.dir(\"Plots\", \"test\", \"travis_commands.jl\"))"

View File

@ -21,7 +21,7 @@ const _arg_desc = KW(
:markerstrokewidth => "Number. Width of the marker stroke (border. in pixels)", :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`.", :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.", :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(minimum(x),stop=maximum(x), length=25)`",
:smooth => "Bool. Add a regression line?", :smooth => "Bool. Add a regression line?",
:group => "AbstractVector. Data is split into a separate series, one for each unique value in `group`.", :group => "AbstractVector. Data is split into a separate series, one for each unique value in `group`.",
:x => "Various. Input data. First Dimension", :x => "Various. Input data. First Dimension",

View File

@ -251,7 +251,7 @@ function get_ticks(axis::Axis)
# discrete ticks... # discrete ticks...
n = length(dvals) n = length(dvals)
rng = if ticks == :auto rng = if ticks == :auto
Int[round(Int,i) for i in linspace(1, n, 15)] Int[round(Int,i) for i in range(1, stop=n, length=15)]
else # if ticks == :all else # if ticks == :all
1:n 1:n
end end
@ -265,7 +265,7 @@ function get_ticks(axis::Axis)
end end
elseif typeof(ticks) <: Union{AVec, Int} elseif typeof(ticks) <: Union{AVec, Int}
if !isempty(dvals) && typeof(ticks) <: Int if !isempty(dvals) && typeof(ticks) <: Int
rng = Int[round(Int,i) for i in linspace(1, length(dvals), ticks)] rng = Int[round(Int,i) for i in range(1, stop=length(dvals), length=ticks)]
axis[:continuous_values][rng], dvals[rng] axis[:continuous_values][rng], dvals[rng]
else else
# override ticks, but get the labels # override ticks, but get the labels

View File

@ -397,7 +397,7 @@ function gappy(x, ps)
return last(ps) - x return last(ps) - x
end end
function ticks(points, resolution) function ticks(points, resolution)
Float16[gappy(x, points) for x = linspace(first(points),last(points), resolution)] Float16[gappy(x, points) for x = range(first(points),stop=last(points), length=resolution)]
end end
@ -901,7 +901,7 @@ function gl_boxplot(d, kw_args)
# filter y # filter y
values = y[filter(i -> _cycle(x,i) == glabel, 1:length(y))] values = y[filter(i -> _cycle(x,i) == glabel, 1:length(y))]
# compute quantiles # compute quantiles
q1,q2,q3,q4,q5 = quantile(values, linspace(0,1,5)) q1,q2,q3,q4,q5 = quantile(values, range(0,stop=1,5))
# notch # notch
n = Plots.notch_width(q2, q4, length(values)) n = Plots.notch_width(q2, q4, length(values))
# warn on inverted notches? # warn on inverted notches?

View File

@ -485,7 +485,7 @@ function gr_colorbar(sp::Subplot, clims)
xmin, xmax = gr_xy_axislims(sp)[1:2] xmin, xmax = gr_xy_axislims(sp)[1:2]
gr_set_viewport_cmap(sp) gr_set_viewport_cmap(sp)
l = zeros(Int32, 1, 256) l = zeros(Int32, 1, 256)
l[1,:] = Int[round(Int, _i) for _i in linspace(1000, 1255, 256)] l[1,:] = Int[round(Int, _i) for _i in range(1000, stop=1255, length=256)]
GR.setscale(0) GR.setscale(0)
GR.setwindow(xmin, xmax, clims[1], clims[2]) GR.setwindow(xmin, xmax, clims[1], clims[2])
GR.cellarray(xmin, xmax, clims[2], clims[1], 1, length(l), l) GR.cellarray(xmin, xmax, clims[2], clims[1], 1, length(l), l)
@ -531,7 +531,7 @@ const _gr_gradient_alpha = ones(256)
function gr_set_gradient(c) function gr_set_gradient(c)
grad = isa(c, ColorGradient) ? c : cgrad() grad = isa(c, ColorGradient) ? c : cgrad()
for (i,z) in enumerate(linspace(0, 1, 256)) for (i,z) in enumerate(range(0, stop=1, length=256))
c = grad[z] c = grad[z]
GR.setcolorrep(999+i, red(c), green(c), blue(c)) GR.setcolorrep(999+i, red(c), green(c), blue(c))
_gr_gradient_alpha[i] = alpha(c) _gr_gradient_alpha[i] = alpha(c)
@ -1051,7 +1051,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
if typeof(series[:levels]) <: AbstractArray if typeof(series[:levels]) <: AbstractArray
h = series[:levels] h = series[:levels]
else else
h = series[:levels] > 1 ? linspace(zmin, zmax, series[:levels]) : [(zmin + zmax) / 2] h = series[:levels] > 1 ? range(zmin, stop=zmax, length=series[:levels]) : [(zmin + zmax) / 2]
end end
if series[:fillrange] != nothing if series[:fillrange] != nothing
GR.surface(x, y, z, GR.OPTION_CELL_ARRAY) GR.surface(x, y, z, GR.OPTION_CELL_ARRAY)

View File

@ -450,7 +450,7 @@ function plotly_colorscale(c::AbstractVector{<:RGBA}, α)
if length(c) == 1 if length(c) == 1
return [[0.0, rgba_string(plot_color(c[1], α))], [1.0, rgba_string(plot_color(c[1], α))]] return [[0.0, rgba_string(plot_color(c[1], α))], [1.0, rgba_string(plot_color(c[1], α))]]
else else
vals = linspace(0.0, 1.0, length(c)) vals = range(0.0, stop=1.0, length=length(c))
return [[vals[i], rgba_string(plot_color(c[i], α))] for i in eachindex(c)] return [[vals[i], rgba_string(plot_color(c[i], α))] for i in eachindex(c)]
end end
end end

View File

@ -31,7 +31,7 @@ animation.
[:(begin [:(begin
p = plot([sin,cos], zeros(0), leg=false) p = plot([sin,cos], zeros(0), leg=false)
anim = Animation() anim = Animation()
for x in linspace(0, 10π, 100) for x in range(0, stop=10π, length=100)
push!(p, x, Float64[sin(x), cos(x)]) push!(p, x, Float64[sin(x), cos(x)])
frame(anim) frame(anim)
end end
@ -158,7 +158,7 @@ PlotExample("Marker types",
markers = filter(m -> m in Plots.supported_markers(), Plots._shape_keys) markers = filter(m -> m in Plots.supported_markers(), Plots._shape_keys)
markers = reshape(markers, 1, length(markers)) markers = reshape(markers, 1, length(markers))
n = length(markers) n = length(markers)
x = linspace(0,10,n+2)[2:end-1] x = range(0,stop=10,length=n+2)[2:end-1]
y = repeat(reshape(reverse(x),1,:), n, 1) y = repeat(reshape(reverse(x),1,:), n, 1)
scatter(x, y, m=(8,:auto), lab=map(string,markers), bg=:linen, xlim=(0,10), ylim=(0,10)) scatter(x, y, m=(8,:auto), lab=map(string,markers), bg=:linen, xlim=(0,10), ylim=(0,10))
end)] end)]
@ -240,7 +240,7 @@ y = rand(10)
plot(y, annotations = (3,y[3],text("this is #3",:left)), leg=false) plot(y, annotations = (3,y[3],text("this is #3",:left)), leg=false)
annotate!([(5, y[5], text("this is #5",16,:red,:center)), annotate!([(5, y[5], text("this is #5",16,:red,:center)),
(10, y[10], text("this is #10",:right,20,"courier"))]) (10, y[10], text("this is #10",:right,20,"courier"))])
scatter!(linspace(2,8,6), rand(6), marker=(50,0.2,:orange), scatter!(range(2,stop=8,length=6), rand(6), marker=(50,0.2,:orange),
series_annotations = ["series","annotations","map","to","series", series_annotations = ["series","annotations","map","to","series",
text("data",:green)]) text("data",:green)])
end)] end)]
@ -293,7 +293,7 @@ PlotExample("3D",
"", "",
[:(begin [:(begin
n = 100 n = 100
ts = linspace(0,8π,n) ts = range(0,stop=8π,length=n)
x = ts .* map(cos,ts) x = ts .* map(cos,ts)
y = 0.1ts .* map(sin,ts) y = 0.1ts .* map(sin,ts)
z = 1:n z = 1:n
@ -325,7 +325,7 @@ PlotExample("Groups and Subplots",
PlotExample("Polar Plots", PlotExample("Polar Plots",
"", "",
[:(begin [:(begin
Θ = linspace(0,1.5π,100) Θ = range(0,stop=1.5π,length=100)
r = abs.(0.1randn(100)+sin.(3Θ)) r = abs.(0.1randn(100)+sin.(3Θ))
plot(Θ, r, proj=:polar, m=2) plot(Θ, r, proj=:polar, m=2)
end)] end)]
@ -370,7 +370,7 @@ PlotExample("Animation with subplots",
plot(log,1,xlims=(1,10π),ylims=(0,5),leg=false),layout=l) plot(log,1,xlims=(1,10π),ylims=(0,5),leg=false),layout=l)
anim = Animation() anim = Animation()
for x = linspace(1,10π,100) for x = range(1,stop=10π,length=100)
plot(push!(p,x,Float64[sin(x),cos(x),atan(x),cos(x),log(x)])) plot(push!(p,x,Float64[sin(x),cos(x),atan(x),cos(x),log(x)]))
frame(anim) frame(anim)
end end
@ -424,7 +424,7 @@ You can use the `line_z` and `marker_z` properties to associate a color with
each line segment or marker in the plot. each line segment or marker in the plot.
""", """,
[:(begin [:(begin
t = linspace(0, 1, 100) t = range(0, stop=1, length=100)
θ = 6π .* t θ = 6π .* t
x = t .* cos.(θ) x = t .* cos.(θ)
y = t .* sin.(θ) y = t .* sin.(θ)

View File

@ -284,7 +284,7 @@ end
# where the points are the control points of the curve # where the points are the control points of the curve
for rng in iter_segments(args...) for rng in iter_segments(args...)
length(rng) < 2 && continue 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!(newx, map(t -> bezier_value(_cycle(x,rng), t), ts))
nanappend!(newy, map(t -> bezier_value(_cycle(y,rng), t), ts)) nanappend!(newy, map(t -> bezier_value(_cycle(y,rng), t), ts))
if z != nothing if z != nothing

View File

@ -518,7 +518,7 @@ end
xs, fs xs, fs
end 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}, 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) # # special handling... 3D parametric function(s)
@ -526,7 +526,7 @@ end
mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u) mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u)
end 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} @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 end
# #

View File

@ -132,7 +132,7 @@ _get_showtheme_args(thm::Symbol, func::Symbol) = thm, get(_color_functions, func
f(r) = sin(r) / r f(r) = sin(r) / r
_norm(x, y) = norm([x, y]) _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')) z = f.(_norm.(x, y'))
wi = 2:3:30 wi = 2:3:30
@ -152,7 +152,7 @@ _get_showtheme_args(thm::Symbol, func::Symbol) = thm, get(_color_functions, func
end end
n = 100 n = 100
ts = linspace(0, 10π, n) ts = range(0, stop=10π, length=n)
x = ts .* cos.(ts) x = ts .* cos.(ts)
y = (0.1ts) .* sin.(ts) y = (0.1ts) .* sin.(ts)
z = 1:n z = 1:n

View File

@ -4,7 +4,7 @@ calcMidpoints(edges::AbstractVector) = Float64[0.5 * (edges[i] + edges[i+1]) for
"Make histogram-like bins of data" "Make histogram-like bins of data"
function binData(data, nbins) function binData(data, nbins)
lo, hi = ignorenan_extrema(data) lo, hi = ignorenan_extrema(data)
edges = collect(linspace(lo, hi, nbins+1)) edges = collect(range(lo, stop=hi, length=nbins+1))
midpoints = calcMidpoints(edges) midpoints = calcMidpoints(edges)
buckets = Int[max(2, min(searchsortedfirst(edges, x), length(edges)))-1 for x in data] buckets = Int[max(2, min(searchsortedfirst(edges, x), length(edges)))-1 for x in data]
counts = zeros(Int, length(midpoints)) counts = zeros(Int, length(midpoints))
@ -119,7 +119,7 @@ function replace_image_with_heatmap(z::Array{T}) where T<:Colorant
n, m = size(z) n, m = size(z)
# idx = 0 # idx = 0
colors = ColorGradient(vec(z)) colors = ColorGradient(vec(z))
newz = reshape(linspace(0, 1, n*m), n, m) newz = reshape(range(0, stop=1, length=n*m), n, m)
newz, colors newz, colors
# newz = zeros(n, m) # newz = zeros(n, m)
# for i=1:n, j=1:m # for i=1:n, j=1:m

View File

@ -9,7 +9,7 @@ Pkg.build("ImageMagick")
Pkg.clone("StatPlots") Pkg.clone("StatPlots")
Pkg.develop("PlotUtils") Pkg.add("PlotUtils")
Pkg.develop("RecipesBase") Pkg.develop("RecipesBase")
# Pkg.clone("Blink") # Pkg.clone("Blink")