From 3006a26500e6f9fea859f082dfbbc7af1f18717d Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Mon, 27 Jun 2016 21:43:57 -0400 Subject: [PATCH] revert precompile; add appveyor; gr fixes for markersize, shapes, and legend entries; add GR to tests again; recipe fixes and cleanup --- appveyor.yml | 25 ++++------ src/Plots.jl | 9 ++-- src/backends/gr.jl | 25 ++++++---- src/recipes.jl | 118 +++------------------------------------------ test/runtests.jl | 2 +- 5 files changed, 37 insertions(+), 142 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c76374ba..9bbd29f6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,14 +1,11 @@ environment: matrix: - - JULIAVERSION: "julialang/bin/winnt/x86/0.3/julia-0.3-latest-win32.exe" - - JULIAVERSION: "julialang/bin/winnt/x64/0.3/julia-0.3-latest-win64.exe" - - JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe" - - JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe" - -branches: - only: - - master - - /release-.*/ +# Releases + - JULIAVERSION: "stable/win32" + - JULIAVERSION: "stable/win64" +# Nightlies + - JULIAVERSION: "download/win32" + - JULIAVERSION: "download/win64" notifications: - provider: Email @@ -18,17 +15,15 @@ notifications: install: # Download most recent Julia Windows binary - - ps: (new-object net.webclient).DownloadFile( - $("http://s3.amazonaws.com/"+$env:JULIAVERSION), - "C:\projects\julia-binary.exe") + - ps: (new-object net.webclient).DownloadFile($("http://status.julialang.org/"+$env:JULIAVERSION), "C:\projects\julia-binary.exe") # Run installer silently, output to C:\projects\julia - C:\projects\julia-binary.exe /S /D=C:\projects\julia build_script: # Need to convert from shallow to complete for Pkg.clone to work - 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 "versioninfo(); Pkg.clone(pwd(), \"Plots\"); Pkg.build(\"Plots\")" test_script: - - C:\projects\julia\bin\julia --check-bounds=yes -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\")" \ No newline at end of file diff --git a/src/Plots.jl b/src/Plots.jl index d6760f33..7a97819a 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,4 +1,5 @@ +__precompile__() module Plots @@ -253,10 +254,10 @@ end # --------------------------------------------------------- -if VERSION >= v"0.4.0-dev+5512" - include("precompile.jl") - _precompile_() -end +# if VERSION >= v"0.4.0-dev+5512" +# include("precompile.jl") +# _precompile_() +# end # --------------------------------------------------------- diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 3b7fde08..ff49bb04 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -257,13 +257,13 @@ function gr_draw_markers(d::KW, x, y, msize, mz) shape = d[:markershape] if shape != :none for i=1:length(x) - msize = cycle(msize, i) + msi = cycle(msize, i) cfunc = isa(shape, Shape) ? gr_set_fillcolor : gr_set_markercolor cfuncind = isa(shape, Shape) ? GR.setfillcolorind : GR.setmarkercolorind # draw a filled in shape, slightly bigger, to estimate a stroke cfunc(d[:markerstrokecolor], d[:markerstrokealpha]) - gr_draw_marker(x[i], y[i], msize*1.2, shape, ) + gr_draw_marker(x[i], y[i], msi*1.2, shape, ) # draw the shape if mz == nothing @@ -273,7 +273,7 @@ function gr_draw_markers(d::KW, x, y, msize, mz) ci = round(Int, 1000 + cycle(mz, i) * 255) cfuncind(ci) end - gr_draw_marker(x[i], y[i], msize, shape) + gr_draw_marker(x[i], y[i], msi, shape) end end end @@ -763,14 +763,13 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) GR.selntran(1) elseif st == :shape - # draw the shapes - gr_set_line(d[:linewidth], :solid, d[:linecolor], d[:linealpha]) - gr_polyline(d[:x], d[:y]) - # draw the interior gr_set_fill(d[:fillcolor], d[:fillalpha]) gr_polyline(d[:x], d[:y], GR.fillarea) + # draw the shapes + gr_set_line(d[:linewidth], :solid, d[:linecolor], d[:linealpha]) + gr_polyline(d[:x], d[:y]) elseif st == :image @@ -828,11 +827,17 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) should_add_to_legend(series) || continue d = series.d st = d[:seriestype] - GR.setlinewidth(d[:linewidth]) + gr_set_line(d[:linewidth], d[:linestyle], d[:linecolor], d[:linealpha]) if st == :path - gr_set_linecolor(d[:linecolor], d[:linealpha]) - GR.setlinetype(gr_linetype[d[:linestyle]]) GR.polyline([xpos - 0.07, xpos - 0.01], [ypos, ypos]) + elseif st == :shape + gr_set_fill(d[:fillcolor], d[:fillalpha]) + l, r = xpos-0.07, xpos-0.01 + b, t = ypos-0.4dy, ypos+0.4dy + x = [l, r, r, l, l] + y = [b, b, t, t, b] + gr_polyline(x, y, GR.fillarea) + gr_polyline(x, y) end gr_draw_markers(d, xpos-[0.06,0.02], [ypos,ypos], 10, nothing) diff --git a/src/recipes.jl b/src/recipes.jl index 1c5f97ae..3944d8a4 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -366,7 +366,7 @@ function bezier_value(pts::AVec, t::Real) end # create segmented bezier curves in place of line segments -@recipe function f(::Type{Val{:curves}}, x, y, z) +@recipe function f(::Type{Val{:curves}}, x, y, z; npoints = 30) args = z != nothing ? (x,y,z) : (x,y) newx, newy = zeros(0), zeros(0) fr = d[:fillrange] @@ -374,7 +374,6 @@ end newz = z != nothing ? zeros(0) : nothing lz = d[:line_z] newlz = lz != nothing ? zeros(0) : nothing - npoints = pop!(d, :npoints, 30) # for each line segment (point series with no NaNs), convert it into a bezier curve # where the points are the control points of the curve @@ -391,12 +390,8 @@ end end if lz != nothing lzrng = cycle(lz, rng) # the line_z's for this segment - # @show lzrng, sizeof(lzrng) map(t -> 1+floor(Int, t * (length(rng)-1)), ts) - # choose the line_z value of the control point just before this t push!(newlz, 0.0) append!(newlz, map(t -> lzrng[1+floor(Int, t * (length(rng)-1))], ts)) - # lzrng = vcat() - # nanappend!(newlz, #map(t -> bezier_value(cycle(lz,rng), t), ts)) end end @@ -596,8 +591,6 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N) @recipe function f(::Type{Val{:boxplot}}, x, y, z; notch=false, range=1.5) - delete!(d, :notch) - delete!(d, :range) xsegs, ysegs = Segments(), Segments() glabels = sort(collect(unique(x))) warning = false @@ -669,7 +662,11 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N) # Outliers @series begin seriestype := :scatter - markershape --> :circle + markershape := :circle + markercolor := d[:fillcolor] + markeralpha := d[:fillalpha] + markerstrokecolor := d[:linecolor] + markerstrokealpha := d[:linealpha] x := outliers_x y := outliers_y primary := false @@ -681,104 +678,6 @@ notch_width(q2, q4, N) = 1.58 * (q4-q2)/sqrt(N) y := ysegs.pts () end - -# @recipe function f(::Type{Val{:boxplot}}, x, y, z; notch=false, range=1.5) -# # Plots.dumpdict(d, "box before", true) - -# # create a list of shapes, where each shape is a single boxplot -# shapes = Shape[] -# groupby = extractGroupArgs(x) -# outliers_y = Float64[] -# outliers_x = Float64[] - -# warning = false - -# for (i, glabel) in enumerate(groupby.groupLabels) - -# # filter y values -# values = d[:y][groupby.groupIds[i]] -# # then compute quantiles -# q1,q2,q3,q4,q5 = quantile(values, linspace(0,1,5)) -# # notch -# n = notch_width(q2, q4, length(values)) - -# if notch && !warning && ( (q2>(q3-n)) || (q4<(q3+n)) ) -# warn("Boxplot's notch went outside hinges. Set notch to false.") -# warning = true # Show the warning only one time -# end - -# # make the shape -# center = discrete_value!(d[:subplot][:xaxis], glabel)[1] -# l, m, r = center - _box_halfwidth, center, center + _box_halfwidth -# # internal nodes for notches -# L, R = center - 0.5 * _box_halfwidth, center + 0.5 * _box_halfwidth -# # outliers -# if Float64(range) != 0.0 # if the range is 0.0, the whiskers will extend to the data -# limit = range*(q4-q2) -# inside = Float64[] -# for value in values -# if (value < (q2 - limit)) || (value > (q4 + limit)) -# push!(outliers_y, value) -# push!(outliers_x, center) -# else -# push!(inside, value) -# end -# end -# # change q1 and q5 to show outliers -# # using maximum and minimum values inside the limits -# q1, q5 = extrema(inside) -# end -# # Box -# xcoords = notch::Bool ? [ -# m, l, r, m, m, NaN, # lower T -# l, l, L, R, r, r, l, NaN, # lower box -# l, l, L, R, r, r, l, NaN, # upper box -# m, l, r, m, m, NaN, # upper T -# ] : [ -# m, l, r, m, m, NaN, # lower T -# l, l, r, r, l, NaN, # lower box -# l, l, r, r, l, NaN, # upper box -# m, l, r, m, m, NaN, # upper T -# ] -# ycoords = notch::Bool ? [ -# q1, q1, q1, q1, q2, NaN, # lower T -# q2, q3-n, q3, q3, q3-n, q2, q2, NaN, # lower box -# q4, q3+n, q3, q3, q3+n, q4, q4, NaN, # upper box -# q5, q5, q5, q5, q4, NaN, # upper T -# ] : [ -# q1, q1, q1, q1, q2, NaN, # lower T -# q2, q3, q3, q2, q2, NaN, # lower box -# q4, q3, q3, q4, q4, NaN, # upper box -# q5, q5, q5, q5, q4, NaN, # upper T -# ] -# push!(shapes, Shape(xcoords, ycoords)) -# end - -# # d[:plotarg_overrides] = KW(:xticks => (1:length(shapes), groupby.groupLabels)) - -# seriestype := :shape -# # n = length(groupby.groupLabels) -# # xticks --> (linspace(0.5,n-0.5,n), groupby.groupLabels) - -# # clean d -# pop!(d, :notch) -# pop!(d, :range) - -# # we want to set the fields directly inside series recipes... args are ignored -# d[:x], d[:y] = Plots.shape_coords(shapes) - -# # Outliers -# @series begin -# seriestype := :scatter -# markershape --> :circle -# x := outliers_x -# y := outliers_y -# primary := false -# () -# end - -# () # expects a tuple returned -# end @deps boxplot shape scatter # --------------------------------------------------------------------------- @@ -808,7 +707,6 @@ end @recipe function f(::Type{Val{:violin}}, x, y, z; trim=true) - delete!(d, :trim) xsegs, ysegs = Segments(), Segments() glabels = sort(collect(unique(x))) for glabel in glabels @@ -845,10 +743,6 @@ end x := newx y := newy seriestype := :path - - # clean up d - pop!(d, :trim) - () end @deps density path diff --git a/test/runtests.jl b/test/runtests.jl index f7aa9c67..8d2e5b78 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -30,7 +30,7 @@ facts("GR") do @fact gr() --> Plots.GRBackend() @fact backend() --> Plots.GRBackend() - # @linux_only image_comparison_facts(:gr, skip=[], eps=img_eps) + @linux_only image_comparison_facts(:gr, skip=[], eps=img_eps) end facts("Plotly") do