more deprecation fixes

This commit is contained in:
Daniel Schwabeneder 2018-07-04 22:33:51 +02:00
parent a7f2484d45
commit 0717805773
7 changed files with 16 additions and 16 deletions

View File

@ -6,7 +6,7 @@ using Reexport
import StaticArrays import StaticArrays
using StaticArrays.FixedSizeArrays using StaticArrays.FixedSizeArrays
using Dates, Printf, Statistics, Base64 using Dates, Printf, Statistics, Base64, LinearAlgebra
@reexport using RecipesBase @reexport using RecipesBase
import RecipesBase: plot, plot!, animate import RecipesBase: plot, plot!, animate

View File

@ -317,7 +317,7 @@ function normalize_zvals(zv::AVec, clims::NTuple{2, <:Real})
if vmin == vmax if vmin == vmax
zeros(length(zv)) zeros(length(zv))
else else
clamp.((zv - vmin) ./ (vmax - vmin), 0, 1) clamp.((zv .- vmin) ./ (vmax .- vmin), 0, 1)
end end
end end

View File

@ -52,7 +52,7 @@ the `z` argument to turn on series gradients.
[:(begin [:(begin
y = rand(100) y = rand(100)
plot(0:10:100,rand(11,4),lab="lines",w=3,palette=:grays,fill=0, α=0.6) plot(0:10:100,rand(11,4),lab="lines",w=3,palette=:grays,fill=0, α=0.6)
scatter!(y, zcolor=abs.(y-.5), m=(:heat,0.8,stroke(1,:green)), ms=10*abs.(y-0.5)+4, scatter!(y, zcolor=abs.(y.-0.5), m=(:heat,0.8,stroke(1,:green)), ms=10*abs.(y.-0.5).+4,
lab="grad") lab="grad")
end)] end)]
), ),
@ -69,7 +69,7 @@ the preprocessing step. You can also use shorthand functions: `title!`, `xaxis!`
y = rand(20,3) y = rand(20,3)
plot(y, xaxis=("XLABEL",(-5,30),0:2:20,:flip), background_color = RGB(0.2,0.2,0.2), plot(y, xaxis=("XLABEL",(-5,30),0:2:20,:flip), background_color = RGB(0.2,0.2,0.2),
leg=false) leg=false)
hline!(mean(y,1)+rand(1,3), line=(4,:dash,0.6,[:lightgreen :green :darkgreen])) hline!(mean(y, dims = 1)+rand(1,3), line=(4,:dash,0.6,[:lightgreen :green :darkgreen]))
vline!([5,10]) vline!([5,10])
title!("TITLE") title!("TITLE")
yaxis!("YLABEL", :log10) yaxis!("YLABEL", :log10)
@ -145,7 +145,7 @@ styles = filter(s -> s in Plots.supported_styles(),
[:solid, :dash, :dot, :dashdot, :dashdotdot]) [:solid, :dash, :dot, :dashdot, :dashdotdot])
styles = reshape(styles, 1, length(styles)) # Julia 0.6 unfortunately gives an error when transposing symbol vectors styles = reshape(styles, 1, length(styles)) # Julia 0.6 unfortunately gives an error when transposing symbol vectors
n = length(styles) n = length(styles)
y = cumsum(randn(20,n),1) y = cumsum(randn(20,n), dims = 1)
plot(y, line = (5, styles), label = map(string,styles), legendtitle = "linestyle") plot(y, line = (5, styles), label = map(string,styles), legendtitle = "linestyle")
end)] end)]
), ),
@ -202,7 +202,7 @@ plot(Plots.fakedata(100,10), layout=4, palette=[:grays :blues :heat :lightrainbo
PlotExample("", PlotExample("",
"", "",
[:(begin [:(begin
srand(111) Random.srand(111)
plot!(Plots.fakedata(100,10)) plot!(Plots.fakedata(100,10))
end)] end)]
), ),
@ -215,7 +215,7 @@ subsequently create a :path series with the appropriate line segments.
""", """,
[:(begin [:(begin
n=20 n=20
hgt=rand(n)+1 hgt=rand(n).+1
bot=randn(n) bot=randn(n)
openpct=rand(n) openpct=rand(n)
closepct=rand(n) closepct=rand(n)
@ -254,7 +254,7 @@ verts = [(-1.0,1.0),(-1.28,0.6),(-0.2,-1.4),(0.2,-1.4),(1.28,0.6),(1.0,1.0),
(-1.0,1.0),(-0.2,-0.6),(0.0,-0.2),(-0.4,0.6),(1.28,0.6),(0.2,-1.4), (-1.0,1.0),(-0.2,-0.6),(0.0,-0.2),(-0.4,0.6),(1.28,0.6),(0.2,-1.4),
(-0.2,-1.4),(0.6,0.2),(-0.2,0.2),(0.0,-0.2),(0.2,0.2),(-0.2,-0.6)] (-0.2,-1.4),(0.6,0.2),(-0.2,0.2),(0.0,-0.2),(0.2,0.2),(-0.2,-0.6)]
x = 0.1:0.2:0.9 x = 0.1:0.2:0.9
y = 0.7rand(5)+0.15 y = 0.7rand(5).+0.15
plot(x, y, line = (3,:dash,:lightblue), marker = (Shape(verts),30,RGBA(0,0,0,0.2)), plot(x, y, line = (3,:dash,:lightblue), marker = (Shape(verts),30,RGBA(0,0,0,0.2)),
bg=:pink, fg=:darkblue, xlim = (0,1), ylim=(0,1), leg=false) bg=:pink, fg=:darkblue, xlim = (0,1), ylim=(0,1), leg=false)
end)] end)]
@ -439,7 +439,7 @@ each line segment or marker in the plot.
# make and display one plot # make and display one plot
function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true) function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true)
Plots._debugMode.on = debug Plots._debugMode.on = debug
info("Testing plot: $pkgname:$idx:$(_examples[idx].header)") @info("Testing plot: $pkgname:$idx:$(_examples[idx].header)")
backend(pkgname) backend(pkgname)
backend() backend()
map(eval, _examples[idx].exprs) map(eval, _examples[idx].exprs)

View File

@ -11,11 +11,11 @@ function _expand_seriestype_array(d::KW, args)
sts = get(d, :seriestype, :path) sts = get(d, :seriestype, :path)
if typeof(sts) <: AbstractArray if typeof(sts) <: AbstractArray
delete!(d, :seriestype) delete!(d, :seriestype)
rd = Vector{RecipeData}(size(sts, 1)) rd = Vector{RecipeData}(undef, size(sts, 1))
for r in 1:size(sts, 1) for r in 1:size(sts, 1)
dc = copy(d) dc = copy(d)
dc[:seriestype] = sts[r:r,:] dc[:seriestype] = sts[r:r,:]
rd[i] = RecipeData(dc, args) rd[r] = RecipeData(dc, args)
end end
rd rd
else else
@ -153,7 +153,7 @@ function _add_smooth_kw(kw_list::Vector{KW}, kw::KW)
x, y = kw[:x], kw[:y] x, y = kw[:x], kw[:y]
β, α = convert(Matrix{Float64}, [x ones(length(x))]) \ convert(Vector{Float64}, y) β, α = convert(Matrix{Float64}, [x ones(length(x))]) \ convert(Vector{Float64}, y)
sx = [ignorenan_minimum(x), ignorenan_maximum(x)] sx = [ignorenan_minimum(x), ignorenan_maximum(x)]
sy = β * sx + α sy = β .* sx .+ α
push!(kw_list, merge(copy(kw), KW( push!(kw_list, merge(copy(kw), KW(
:seriestype => :path, :seriestype => :path,
:x => sx, :x => sx,

View File

@ -14,7 +14,7 @@ function current()
if isplotnull() if isplotnull()
error("No current plot/subplot") error("No current plot/subplot")
end end
get(CURRENT_PLOT.nullableplot) CURRENT_PLOT.nullableplot
end end
current(plot::AbstractPlot) = (CURRENT_PLOT.nullableplot = plot) current(plot::AbstractPlot) = (CURRENT_PLOT.nullableplot = plot)
@ -65,7 +65,7 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...)
# build our plot vector from the args # build our plot vector from the args
n = length(plts_tail) + 1 n = length(plts_tail) + 1
plts = Array{Plot}(n) plts = Array{Plot}(undef, n)
plts[1] = plt1 plts[1] = plt1
for (i,plt) in enumerate(plts_tail) for (i,plt) in enumerate(plts_tail)
plts[i+1] = plt plts[i+1] = plt

View File

@ -586,7 +586,7 @@ function _auto_binning_nbins(vs::NTuple{N,AbstractVector}, dim::Integer; mode::S
_iqr(v) = (q = quantile(v, 0.75) - quantile(v, 0.25); q > 0 ? q : oftype(q, 1)) _iqr(v) = (q = quantile(v, 0.75) - quantile(v, 0.25); q > 0 ? q : oftype(q, 1))
_span(v) = ignorenan_maximum(v) - ignorenan_minimum(v) _span(v) = ignorenan_maximum(v) - ignorenan_minimum(v)
n_samples = length(linearindices(first(vs))) n_samples = length(LinearIndices(first(vs)))
# The nd estimator is the key to most automatic binning methods, and is modified for twodimensional histograms to include correlation # The nd estimator is the key to most automatic binning methods, and is modified for twodimensional histograms to include correlation
nd = n_samples^(1/(2+N)) nd = n_samples^(1/(2+N))

View File

@ -382,7 +382,7 @@ end
function convert_to_polar(x, y, r_extrema = calc_r_extrema(x, y)) function convert_to_polar(x, y, r_extrema = calc_r_extrema(x, y))
rmin, rmax = r_extrema rmin, rmax = r_extrema
theta, r = filter_radial_data(x, y, r_extrema) theta, r = filter_radial_data(x, y, r_extrema)
r = (r - rmin) / (rmax - rmin) r = (r .- rmin) ./ (rmax .- rmin)
x = r.*cos.(theta) x = r.*cos.(theta)
y = r.*sin.(theta) y = r.*sin.(theta)
x, y x, y