From 8a7b7f5c9b5ca6b1cfafda7efbec9394e063d153 Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Wed, 7 Jun 2017 17:03:58 +0200 Subject: [PATCH 1/4] Up requirement to 0.6 --- .travis.yml | 2 +- NEWS.md | 4 +++- REQUIRE | 2 +- test/imgcomp.jl | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1253ee9a..bbeac50e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: - linux # - osx julia: - - 0.5 + - 0.6 matrix: allow_failures: - julia: nightly diff --git a/NEWS.md b/NEWS.md index e796292b..2637f9bb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,7 +10,9 @@ --- -## 0.11 (current master/dev) +## 0.12 (current master/dev) + +- 0.6 only #### 0.11.3 diff --git a/REQUIRE b/REQUIRE index c5b623ea..2d184bf7 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.5 +julia 0.6 RecipesBase PlotUtils 0.4.1 diff --git a/test/imgcomp.jl b/test/imgcomp.jl index c25c7850..994670f9 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -24,7 +24,7 @@ default(size=(500,300)) # TODO: use julia's Condition type and the wait() and notify() functions to initialize a Window, then wait() on a condition that # is referenced in a button press callback (the button clicked callback will call notify() on that condition) -const _current_plots_version = v"0.11.3" +const _current_plots_version = v"0.12.0" function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], eps = 1e-2) From 7415a362c4839526c291a1134c8acb4e4215cac4 Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Wed, 7 Jun 2017 17:06:06 +0200 Subject: [PATCH 2/4] reactivate precompilation --- src/Plots.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plots.jl b/src/Plots.jl index 6c2d129d..9b613056 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,4 +1,4 @@ -__precompile__(false) +__precompile__(true) module Plots From f097fb57b5fd1da3fce6d6a1cf5c256054a14486 Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Wed, 7 Jun 2017 18:13:09 +0200 Subject: [PATCH 3/4] Fix some deprecation warnings --- src/backends/gr.jl | 4 ++-- src/components.jl | 2 +- src/deprecated/colors.jl | 2 +- src/series.jl | 4 ++-- src/subplots.jl | 2 +- src/types.jl | 6 +++--- src/utils.jl | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 0f2a959b..cd9c0158 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -706,7 +706,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) rotation = sp[:xaxis][:rotation]) for (cv, dv) in zip(xticks...) # use xor ($) to get the right y coords - xi, yi = GR.wctondc(cv, (flip $ mirror) ? ymax : ymin) + xi, yi = GR.wctondc(cv, xor(flip, mirror) ? ymax : ymin) # @show cv dv ymin xi yi flip mirror (flip $ mirror) gr_text(xi, yi + (mirror ? 1 : -1) * 5e-3, string(dv)) end @@ -723,7 +723,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) rotation = sp[:yaxis][:rotation]) for (cv, dv) in zip(yticks...) # use xor ($) to get the right y coords - xi, yi = GR.wctondc((flip $ mirror) ? xmax : xmin, cv) + xi, yi = GR.wctondc(xor(flip, mirror) ? xmax : xmin, cv) # @show cv dv xmin xi yi gr_text(xi + (mirror ? 1 : -1) * 1e-2, yi, string(dv)) end diff --git a/src/components.jl b/src/components.jl index 6a935c95..8a78c9f5 100644 --- a/src/components.jl +++ b/src/components.jl @@ -507,7 +507,7 @@ end # ----------------------------------------------------------------------- -abstract AbstractSurface +abstract type AbstractSurface end "represents a contour or surface mesh" immutable Surface{M<:AMat} <: AbstractSurface diff --git a/src/deprecated/colors.jl b/src/deprecated/colors.jl index ebc75222..f73d5db6 100644 --- a/src/deprecated/colors.jl +++ b/src/deprecated/colors.jl @@ -1,5 +1,5 @@ -abstract ColorScheme +abstract type ColorScheme end Base.getindex(scheme::ColorScheme, i::Integer) = getColor(scheme, i) diff --git a/src/series.jl b/src/series.jl index f1ee5739..ca520168 100644 --- a/src/series.jl +++ b/src/series.jl @@ -6,7 +6,7 @@ # This should cut down on boilerplate code and allow more focused dispatch on type # note: returns meta information... mainly for use with automatic labeling from DataFrames for now -typealias FuncOrFuncs{F} Union{F, Vector{F}, Matrix{F}} +const FuncOrFuncs{F} = Union{F, Vector{F}, Matrix{F}} all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image), get(d, :seriestype, :none)) @@ -318,7 +318,7 @@ end @recipe function f{T<:Colorant}(mat::AMat{T}) n, m = size(mat) - + if is_seriestype_supported(:image) seriestype := :image SliceIt, 1:m, 1:n, Surface(mat) diff --git a/src/subplots.jl b/src/subplots.jl index 924cc6c0..ccd1478c 100644 --- a/src/subplots.jl +++ b/src/subplots.jl @@ -32,7 +32,7 @@ get_subplot(plt::Plot, k) = plt.spmap[k] get_subplot(series::Series) = series.d[:subplot] get_subplot_index(plt::Plot, idx::Integer) = Int(idx) -get_subplot_index(plt::Plot, sp::Subplot) = findfirst(_ -> _ === sp, plt.subplots) +get_subplot_index(plt::Plot, sp::Subplot) = findfirst(x -> x === sp, plt.subplots) series_list(sp::Subplot) = sp.series_list # filter(series -> series.d[:subplot] === sp, sp.plt.series_list) diff --git a/src/types.jl b/src/types.jl index 284b6534..06ddb065 100644 --- a/src/types.jl +++ b/src/types.jl @@ -8,9 +8,9 @@ const KW = Dict{Symbol,Any} immutable PlotsDisplay <: Display end -abstract AbstractBackend -abstract AbstractPlot{T<:AbstractBackend} -abstract AbstractLayout +abstract type AbstractBackend end +abstract type AbstractPlot{T<:AbstractBackend} end +abstract type AbstractLayout end # ----------------------------------------------------------- diff --git a/src/utils.jl b/src/utils.jl index bc133c7a..1de784e1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -469,7 +469,7 @@ ok(tup::Tuple) = ok(tup...) # compute one side of a fill range from a ribbon function make_fillrange_side(y, rib) frs = zeros(length(y)) - for (i, (yi, ri)) in enumerate(zip(y, Base.cycle(rib))) + for (i, (yi, ri)) in enumerate(zip(y, Base.Iterators.cycle(rib))) frs[i] = yi + ri end frs From 3a2ee0fc724b78e6986d356044e4b69bcb2fae67 Mon Sep 17 00:00:00 2001 From: "Michael K. Borregaard" Date: Wed, 7 Jun 2017 23:47:13 +0200 Subject: [PATCH 4/4] Fix some deprecations --- REQUIRE | 2 +- src/Plots.jl | 11 ++++++++++- src/examples.jl | 4 ++-- src/plot.jl | 2 +- src/recipes.jl | 2 +- src/utils.jl | 4 ++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/REQUIRE b/REQUIRE index 2d184bf7..39402c3d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.6 +julia 0.6-pre RecipesBase PlotUtils 0.4.1 diff --git a/src/Plots.jl b/src/Plots.jl index 9b613056..2f9caeca 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,4 +1,4 @@ -__precompile__(true) +__precompile__(false) module Plots @@ -118,6 +118,15 @@ ignoreNaN_extrema(x) = Base.extrema(x) # --------------------------------------------------------- +# to cater for block matrices, Base.transpose is recursive. +# This makes it impossible to create row vectors of String and Symbol with the transpose operator. +# This solves this issue, internally in Plots at least. + +Base.transpose(x::Symbol) = x +Base.transpose(x::String) = x + +# --------------------------------------------------------- + import Measures import Measures: Length, AbsoluteLength, Measure, BoundingBox, mm, cm, inch, pt, width, height, w, h const BBox = Measures.Absolute2DBox diff --git a/src/examples.jl b/src/examples.jl index 7025999f..e4c13ca6 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -41,7 +41,7 @@ PlotExample("Colors", [:(begin y = rand(100) 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, lab="grad") + scatter!(y, zcolor=abs.(y-.5), m=(:heat,0.8,stroke(1,:green)), ms=10*abs.(y-0.5)+4, lab="grad") end)] ), @@ -269,7 +269,7 @@ PlotExample("Polar Plots", "", [:(begin Θ = linspace(0,1.5π,100) - r = abs(0.1randn(100)+sin(3Θ)) + r = abs.(0.1randn(100)+sin.(3Θ)) plot(Θ, r, proj=:polar, m=2) end)] ), diff --git a/src/plot.jl b/src/plot.jl index 2e8063af..3ab41701 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -60,7 +60,7 @@ function plot(plt1::Plot, plts_tail::Plot...; kw...) # build our plot vector from the args n = length(plts_tail) + 1 - plts = Array(Plot, n) + plts = Array{Plot}(n) plts[1] = plt1 for (i,plt) in enumerate(plts_tail) plts[i+1] = plt diff --git a/src/recipes.jl b/src/recipes.jl index e8ea3096..a474bd74 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -669,7 +669,7 @@ end edge_x, edge_y, weights = x, y, z.surf float_weights = float(weights) - if is(float_weights, weights) + if float_weights === weights float_weights = deepcopy(float_weights) end for (i, c) in enumerate(float_weights) diff --git a/src/utils.jl b/src/utils.jl index 1de784e1..8f51fc4d 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -355,8 +355,8 @@ function convert_to_polar(x, y, r_extrema = calc_r_extrema(x, y)) x = zeros(n) y = zeros(n) for i in 1:n - x[i] = cycle(r,i) * cos(cycle(phi,i)) - y[i] = cycle(r,i) * sin(cycle(phi,i)) + x[i] = cycle(r,i) * cos.(cycle(phi,i)) + y[i] = cycle(r,i) * sin.(cycle(phi,i)) end x, y end