From c2dc030fae7529ee102e41affcb0a9fbbe934279 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Sat, 11 Aug 2018 11:24:45 +0100 Subject: [PATCH 1/2] fieldnames(x) -> fieldnames(typeof(x)) --- src/backends/hdf5.jl | 2 +- src/themes.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/themes.jl b/src/themes.jl index 5d1c032f..8d79ae64 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( From 3e56aa43e446f4bbfe5359a3b6f842aad46b294a Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Sat, 11 Aug 2018 11:24:54 +0100 Subject: [PATCH 2/2] linspace -> range --- src/arg_desc.jl | 2 +- src/deprecated/colors.jl | 4 ++-- src/recipes.jl | 2 +- src/series.jl | 4 ++-- src/themes.jl | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) 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/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..b8bc4abe 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 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 8d79ae64..da313498 100644 --- a/src/themes.jl +++ b/src/themes.jl @@ -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