From 0710fba638ad143abeb6ec44015b9adf0281854b Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 14 Aug 2018 10:24:01 +0200 Subject: [PATCH 1/5] Update instances of `findfirst` to 1.0 syntax --- src/backends/plotlyjs.jl | 2 +- src/plot.jl | 4 ++-- src/plotattr.jl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 1482b717..127aef52 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -38,7 +38,7 @@ function _series_updated(plt::Plot{PlotlyJSBackend}, series::Series) end PlotlyJS.restyle!( plt.o, - findfirst(plt.series_list, series), + findfirst(isequal(series), plt.series_list), kw ) end diff --git a/src/plot.jl b/src/plot.jl index 9d0ee6c4..ccce63d1 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -283,11 +283,11 @@ end function plot(sp::Subplot, args...; kw...) plt = sp.plt - plot(plt, args...; kw..., subplot = findfirst(plt.subplots, sp)) + plot(plt, args...; kw..., subplot = findfirst(isequal(sp), plt.subplots)) end function plot!(sp::Subplot, args...; kw...) plt = sp.plt - plot!(plt, args...; kw..., subplot = findfirst(plt.subplots, sp)) + plot!(plt, args...; kw..., subplot = findfirst(isequal(sp), plt.subplots)) end # -------------------------------------------------------------------- diff --git a/src/plotattr.jl b/src/plotattr.jl index 7313b2ce..42e3edf5 100644 --- a/src/plotattr.jl +++ b/src/plotattr.jl @@ -46,7 +46,7 @@ function plotattr(attrtype::Symbol, attribute::AbstractString) attribute = Symbol(lookup_aliases(attrtype, attribute)) desc = get(_arg_desc, attribute, "") - first_period_idx = findfirst(desc, '.') + first_period_idx = findfirst(isequal('.'), desc) typedesc = desc[1:first_period_idx-1] desc = strip(desc[first_period_idx+1:end]) als = keys(filter((_,v)->v==attribute, _keyAliases)) |> collect |> sort From 8131953e49d50a93bd44a63970cfb39f7cf92511 Mon Sep 17 00:00:00 2001 From: MA Laforge Date: Tue, 14 Aug 2018 13:04:22 -0700 Subject: [PATCH 2/5] Deal w/deprecation of Nullable. Also use new LinearIndices API. --- src/backends/hdf5.jl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backends/hdf5.jl b/src/backends/hdf5.jl index 2c6b3ecb..8389c496 100644 --- a/src/backends/hdf5.jl +++ b/src/backends/hdf5.jl @@ -41,6 +41,7 @@ end #==Useful constants ===============================================================================# +const _hdf5_nullable{T} = Union{T, Nothing} const _hdf5_plotroot = "plot" const _hdf5_dataroot = "data" #TODO: Eventually move data to different root (easier to locate)? const _hdf5plot_datatypeid = "TYPE" #Attribute identifying type @@ -129,7 +130,7 @@ if length(HDF5PLOT_MAP_TELEM2STR) < 1 "AXIS" => Axis, "SURFACE" => Surface, "SUBPLOT" => Subplot, - "NULLABLE" => Nullable, + "NULLABLE" => _hdf5_nullable, ) merge!(HDF5PLOT_MAP_STR2TELEM, telem2str) merge!(HDF5PLOT_MAP_TELEM2STR, Dict{Type, String}(v=>k for (k,v) in HDF5PLOT_MAP_STR2TELEM)) @@ -344,9 +345,10 @@ function _hdf5plot_gwritearray(grp, k::String, v::Array{T}) where T vgrp = HDF5.g_create(grp, k) _hdf5plot_writetype(vgrp, Array) #ANY sz = size(v) + lidx = LinearIndices(sz) for iter in eachindex(v) - coord = LinearIndices(sz, iter) + coord = lidx[iter] elem = v[iter] idxstr = join(coord, "_") _hdf5plot_gwrite(vgrp, "v$idxstr", v[iter]) @@ -391,7 +393,7 @@ function _hdf5plot_gwrite(grp, k::String, v::Surface) _hdf5plot_writetype(grp, Surface) end # #TODO: "Properly" support Nullable using _hdf5plot_writetype? -# function _hdf5plot_gwrite(grp, k::String, v::Nullable) +# function _hdf5plot_gwrite(grp, k::String, v::_hdf5_nullable) # if isnull(v) # _hdf5plot_gwrite(grp, k, nothing) # else @@ -508,10 +510,11 @@ function _hdf5plot_read(grp, k::String, T::Type{Array}, dtid) #ANY sz = _hdf5plot_read(grp, "dim") if [0] == sz; return []; end sz = tuple(sz...) - result = Array{Any}(sz) + result = Array{Any}(undef, sz) + lidx = LinearIndices(sz) for iter in eachindex(result) - coord = LinearIndices(sz, iter) + coord = lidx[iter] idxstr = join(coord, "_") result[iter] = _hdf5plot_read(grp, "v$idxstr") end From befb14682d0cf82ea1a25ef38b4f8bd76a0e0d64 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 14 Aug 2018 23:28:18 +0200 Subject: [PATCH 3/5] Add more packages to PyPlot string --- src/backends.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backends.jl b/src/backends.jl index 7f5bcd77..d6dc3bea 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -400,7 +400,10 @@ function add_backend_string(::PyPlotBackend) """ using Pkg Pkg.add("PyPlot") + Pkg.add("PyCall") + Pkg.add("LaTeXStrings") withenv("PYTHON" => "") do + Pkg.build("PyCall") Pkg.build("PyPlot") end """ From 593804096d9ef333b7bb47da963dc7dff90db5f0 Mon Sep 17 00:00:00 2001 From: Roshan Shariff Date: Tue, 14 Aug 2018 15:38:55 -0600 Subject: [PATCH 4/5] Fix julia 0.7 deprecated syntax in Plotly backend. --- src/backends/plotly.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 51c24c85..810a5e88 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -645,7 +645,7 @@ end function plotly_series_shapes(plt::Plot, series::Series) segments = iter_segments(series) - d_outs = Vector{KW}(length(segments)) + d_outs = Vector{KW}(undef, length(segments)) # TODO: create a d_out for each polygon # x, y = series[:x], series[:y] @@ -707,7 +707,7 @@ function plotly_series_segments(series::Series, d_base::KW, x, y, z) (isa(series[:fillrange], AbstractVector) || isa(series[:fillrange], Tuple)) segments = iter_segments(series) - d_outs = Vector{KW}((hasfillrange ? 2 : 1 ) * length(segments)) + d_outs = Vector{KW}(undef, (hasfillrange ? 2 : 1 ) * length(segments)) for (i,rng) in enumerate(segments) !isscatter && length(rng) < 2 && continue From 2d217edc157afda5112992b82d9d2b707b8b6610 Mon Sep 17 00:00:00 2001 From: Michael Krabbe Borregaard Date: Tue, 14 Aug 2018 23:56:21 +0200 Subject: [PATCH 5/5] update news.md --- NEWS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index 10378f0f..2ef59484 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,12 @@ ## (current master) - All new development should target Julia 1.x! +## 0.19.2 +- several small fixes for 1.0 compatibility + +## 0.19.1 +- don't broadcast plot_color + ## 0.19.0 - Refactor conditional loading to use Requires - Many fixes for 1.0 compatibility