From a731ef6e2d6b745d19b660346ce9d1fd0f753e0e Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 2 Sep 2018 22:28:34 +0200 Subject: [PATCH 01/19] plotlyjs, pyplot and test fixes --- src/backends.jl | 22 +++++++--------- src/backends/plotlyjs.jl | 5 +++- src/backends/pyplot.jl | 2 +- test/add_packages.jl | 13 +++++++++- test/imgcomp.jl | 2 +- test/runtests.jl | 56 +++++++++++++++++++++------------------- 6 files changed, 57 insertions(+), 43 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 6a5dea31..55c37cdf 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -347,16 +347,6 @@ function _initialize_backend(::GLVisualizeBackend; kw...) end end -# ------------------------------------------------------------------------------ -# hdf5 - -function _initialize_backend(::HDF5Backend) - @eval Main begin - import HDF5 - export HDF5 - end -end - # ------------------------------------------------------------------------------ # PGFPLOTS @@ -371,11 +361,19 @@ end # ------------------------------------------------------------------------------ # plotlyjs +function _initialize_backend(pkg::PlotlyJSBackend) + sym = backend_package_name(pkg) + @eval Main begin + import PlotlyJS, ORCA + export PlotlyJS + end +end + function add_backend_string(::PlotlyJSBackend) """ using Pkg - Pkg.add("PlotlyJS") - Pkg.add("Rsvg") + Pkg.add(["PlotlyJS", "Blink"]) + Pkg.add(PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master")) import Blink Blink.AtomShell.install() """ diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 98e626c1..6e06ce71 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -12,7 +12,10 @@ const _plotlyjs_scale = _plotly_scale function _create_backend_figure(plt::Plot{PlotlyJSBackend}) if !isplotnull() && plt[:overwrite_figure] && isa(current().o, PlotlyJS.SyncPlot) - PlotlyJS.SyncPlot(PlotlyJS.Plot(), current().o.view) + PlotlyJS.SyncPlot(PlotlyJS.Plot(), + events = current().o.events, + options = current().o.options, + ) else PlotlyJS.plot() end diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index f6fc6ee4..4d171847 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1061,7 +1061,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) ticks = sp[:framestyle] == :none ? nothing : get_ticks(axis) # don't show the 0 tick label for the origin framestyle if sp[:framestyle] == :origin && length(ticks) > 1 - ticks[2][ticks[1] .== 0] = "" + ticks[2][ticks[1] .== 0] .= "" end axis[:ticks] != :native ? py_set_ticks(ax, ticks, letter) : nothing pyaxis[:set_tick_params](direction = axis[:tick_direction] == :out ? "out" : "in") diff --git a/test/add_packages.jl b/test/add_packages.jl index 260707d3..1b143c46 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -4,7 +4,6 @@ using Pkg # ENV["PYTHON"] = "" to_add = [ - PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git"), # PackageSpec(url="https://github.com/JuliaStats/KernelDensity.jl.git"), PackageSpec(name="PlotUtils", rev="master"), PackageSpec(name="RecipesBase", rev="master"), @@ -17,12 +16,24 @@ to_add = [ ] if isinteractive() + Pkg.develop(PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) append!(to_add, [ PackageSpec(name="FileIO"), PackageSpec(name="ImageMagick"), PackageSpec(name="UnicodePlots"), PackageSpec(name="VisualRegressionTests"), + PackageSpec(name="Gtk"), + # PlotlyJS: + # PackageSpec(name="PlotlyJS", rev="master"), + # PackageSpec(name="Blink"), + # PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + # PyPlot: + # PackageSpec(name="PyPlot"), + # PackageSpec(name="PyCall"), + # PackageSpec(name="LaTeXStrings"), ]) +else + push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) end Pkg.add(to_add) diff --git a/test/imgcomp.jl b/test/imgcomp.jl index 1145f272..8d289f55 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -29,7 +29,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.17.4" +const _current_plots_version = v"0.20.1" function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], tol = 1e-2) diff --git a/test/runtests.jl b/test/runtests.jl index 543b8ea3..43ffdac4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,40 +17,42 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end - -#@testset "PyPlot" begin -# @test pyplot() == Plots.PyPlotBackend() -# @test backend() == Plots.PyPlotBackend() +# @static if isinteractive() +# @testset "PyPlot" begin +# @test pyplot() == Plots.PyPlotBackend() +# @test backend() == Plots.PyPlotBackend() # -# image_comparison_facts(:pyplot, tol=img_tol) -#end +# image_comparison_facts(:pyplot, tol=img_tol, skip = [25, 30]) +# end +# end -@testset "UnicodePlots" begin - @test unicodeplots() == Plots.UnicodePlotsBackend() - @test backend() == Plots.UnicodePlotsBackend() - - # lets just make sure it runs without error - @test isa(plot(rand(10)), Plots.Plot) == true -end +# @testset "UnicodePlots" begin +# @test unicodeplots() == Plots.UnicodePlotsBackend() +# @test backend() == Plots.UnicodePlotsBackend() +# +# # lets just make sure it runs without error +# @test isa(plot(rand(10)), Plots.Plot) == true +# end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) -# @testset "PlotlyJS" begin -# @test plotlyjs() == Plots.PlotlyJSBackend() -# @test backend() == Plots.PlotlyJSBackend() -# -# if Sys.islinux() && isinteractive() -# image_comparison_facts(:plotlyjs, -# skip=[ -# 2, # animation (skipped for speed) -# 27, # (polar plots) takes very long / not working -# 31, # animation (skipped for speed) -# ], -# tol=img_tol) -# end -# end +@static if isinteractive() + @testset "PlotlyJS" begin + @test plotlyjs() == Plots.PlotlyJSBackend() + @test backend() == Plots.PlotlyJSBackend() + image_comparison_facts(:plotlyjs, + skip=[ + 2, # animation (skipped for speed) + 25, + 27, # (polar plots) takes very long / not working + 30, + 31, # animation (skipped for speed) + ], + tol=img_tol) + end +end # InspectDR returns that error on travis: # ERROR: LoadError: InitError: Cannot open display: From 1bbe800dcd6f9a423459fc84ebd94b996f8f7826 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 3 Sep 2018 17:30:50 +0200 Subject: [PATCH 02/19] move _current_plots_version from PlotDocs to Plots --- src/Plots.jl | 2 ++ test/imgcomp.jl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Plots.jl b/src/Plots.jl index f6e4b19f..16fe38c6 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,5 +1,7 @@ module Plots +_current_plots_version = v"0.20.1" + using Reexport import StaticArrays diff --git a/test/imgcomp.jl b/test/imgcomp.jl index 8d289f55..526d695e 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -29,7 +29,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.20.1" +import Plots._current_plots_version function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], tol = 1e-2) From f0f90d87afe51cf2ca74b7a5728d00cc31f07639 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Tue, 4 Sep 2018 19:08:48 +0200 Subject: [PATCH 03/19] move supported backend attr to backends.jl --- src/backends.jl | 389 ++++++++++++++++++++++++++++++++++- src/backends/glvisualize.jl | 48 +---- src/backends/gr.jl | 59 ------ src/backends/hdf5.jl | 41 ---- src/backends/inspectdr.jl | 53 ----- src/backends/pgfplots.jl | 41 ---- src/backends/plotly.jl | 54 ----- src/backends/plotlyjs.jl | 6 - src/backends/pyplot.jl | 49 ----- src/backends/unicodeplots.jl | 22 -- src/examples.jl | 8 + test/add_packages.jl | 12 +- test/runtests.jl | 32 +-- 13 files changed, 419 insertions(+), 395 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 55c37cdf..c6ecaf2a 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -330,6 +330,126 @@ function add_backend_string(pkg::AbstractBackend) """ end +# ------------------------------------------------------------------------------ +# gr + +const _gr_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_legend, :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, + :layout, + :title, :window_title, + :guide, :lims, :ticks, :scale, :flip, + :match_dimensions, + :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, + :titlefontrotation, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfonthalign, :legendfontvalign, + :legendfontrotation, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign, + :tickfontrotation, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign, + :guidefontrotation, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :legendtitle, :colorbar, :colorbar_title, + :fill_z, :line_z, :marker_z, :levels, + :ribbon, :quiver, + :orientation, + :overwrite_figure, + :polar, + :aspect_ratio, + :normalize, :weights, + :inset_subplots, + :bar_width, + :arrow, + :framestyle, + :tick_direction, + :camera, + :contour_labels, +]) +const _gr_seriestype = [ + :path, :scatter, :straightline, + :heatmap, :pie, :image, + :contour, :path3d, :scatter3d, :surface, :wireframe, + :shape +] +const _gr_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] +const _gr_marker = _allMarkers +const _gr_scale = [:identity, :log10] +is_marker_supported(::GRBackend, shape::Shape) = true + +function add_backend_string(::GRBackend) + """ + Pkg.add("GR") + Pkg.build("GR") + """ +end + +# ------------------------------------------------------------------------------ +# plotly + +const _plotly_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_legend, :foreground_color_guide, + :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :foreground_color_title, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, + :fillrange, :fillcolor, :fillalpha, + :bins, + :title, :title_location, + :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, + :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :gridalpha, :gridlinewidth, + :legend, :colorbar, :colorbar_title, + :marker_z, :fill_z, :line_z, :levels, + :ribbon, :quiver, + :orientation, + # :overwrite_figure, + :polar, + :normalize, :weights, + # :contours, + :aspect_ratio, + :hover, + :inset_subplots, + :bar_width, + :clims, + :framestyle, + :tick_direction, + :camera, + :contour_labels, + ]) + +const _plotly_seriestype = [ + :path, :scatter, :pie, :heatmap, + :contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl, + :straightline +] +const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot] +const _plotly_marker = [ + :none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, + :cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline +] +const _plotly_scale = [:identity, :log10] + # ------------------------------------------------------------------------------ # glvisualize @@ -347,8 +467,56 @@ function _initialize_backend(::GLVisualizeBackend; kw...) end end +const _glvisualize_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :titlefontsize, :titlefontcolor, + :legendfontsize, :legendfontcolor, + :tickfontsize, + :guidefontsize, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :colorbar, + :marker_z, + :line_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + #:polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :hover, + :framestyle, + :tick_direction, +]) +const _glvisualize_seriestype = [ + :path, :shape, :straightline, + :scatter, :hexbin, + :bar, :boxplot, + :heatmap, :image, :volume, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe +] +const _glvisualize_style = [:auto, :solid, :dash, :dot, :dashdot] +const _glvisualize_marker = _allMarkers +const _glvisualize_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ -# PGFPLOTS +# pgfplots function add_backend_string(::PGFPlotsBackend) """ @@ -358,6 +526,46 @@ function add_backend_string(::PGFPlotsBackend) """ end +const _pgfplots_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, + :background_color_inside, + # :background_color_outside, + # :foreground_color_legend, + :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, + :fillrange, :fillcolor, :fillalpha, + :bins, + # :bar_width, :bar_edges, + :title, + # :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :legend, + :colorbar, :colorbar_title, + :fill_z, :line_z, :marker_z, :levels, + # :ribbon, :quiver, :arrow, + # :orientation, + # :overwrite_figure, + :polar, + # :normalize, :weights, :contours, + :aspect_ratio, + # :match_dimensions, + :tick_direction, + :framestyle, + :camera, + :contour_labels, + ]) +const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] +const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] +const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon, :hline] #vcat(_allMarkers, Shape) +const _pgfplots_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ # plotlyjs @@ -379,6 +587,12 @@ function add_backend_string(::PlotlyJSBackend) """ end +const _plotlyjs_attr = _plotly_attr +const _plotlyjs_seriestype = _plotly_seriestype +const _plotlyjs_style = _plotly_style +const _plotlyjs_marker = _plotly_marker +const _plotlyjs_scale = _plotly_scale + # ------------------------------------------------------------------------------ # pyplot @@ -407,8 +621,59 @@ function add_backend_string(::PyPlotBackend) """ end +const _pyplot_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, :titlefont, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :titlefontfamily, :titlefontsize, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :legendtitle, :colorbar, + :marker_z, :line_z, :fill_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + :polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :colorbar_title, + :stride, + :framestyle, + :tick_direction, + :camera, + :contour_labels, + ]) +const _pyplot_seriestype = [ + :path, :steppre, :steppost, :shape, :straightline, + :scatter, :hexbin, #:histogram2d, :histogram, + # :bar, + :heatmap, :pie, :image, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe + ] +const _pyplot_style = [:auto, :solid, :dash, :dot, :dashdot] +const _pyplot_marker = vcat(_allMarkers, :pixel) +const _pyplot_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ # unicodeplots + function add_backend_string(::UnicodePlotsBackend) """ using Pkg @@ -416,3 +681,125 @@ function add_backend_string(::UnicodePlotsBackend) Pkg.build("UnicodePlots") """ end + +const _unicodeplots_attr = merge_with_base_supported([ + :label, + :legend, + :seriescolor, + :seriesalpha, + :linestyle, + :markershape, + :bins, + :title, + :guide, :lims, + ]) +const _unicodeplots_seriestype = [ + :path, :scatter, :straightline, + # :bar, + :shape, + :histogram2d, + :spy +] +const _unicodeplots_style = [:auto, :solid] +const _unicodeplots_marker = [:none, :auto, :circle] +const _unicodeplots_scale = [:identity] + +# ------------------------------------------------------------------------------ +# hdf5 + +const _hdf5_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, :titlefont, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :legend, :colorbar, + :marker_z, :line_z, :fill_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + :polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :colorbar_title, + ]) +const _hdf5_seriestype = [ + :path, :steppre, :steppost, :shape, :straightline, + :scatter, :hexbin, #:histogram2d, :histogram, + # :bar, + :heatmap, :pie, :image, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe + ] +const _hdf5_style = [:auto, :solid, :dash, :dot, :dashdot] +const _hdf5_marker = vcat(_allMarkers, :pixel) +const _hdf5_scale = [:identity, :ln, :log2, :log10] + +# ------------------------------------------------------------------------------ +# inspectdr + +const _inspectdr_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + # :foreground_color_grid, + :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :markerstrokestyle, #Causes warning not to have it... what is this? + :fillcolor, :fillalpha, #:fillrange, +# :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, + :window_title, + :guide, :lims, :scale, #:ticks, :flip, :rotation, + :titlefontfamily, :titlefontsize, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :grid, :legend, #:colorbar, +# :marker_z, +# :line_z, +# :levels, + # :ribbon, :quiver, :arrow, +# :orientation, + :overwrite_figure, + :polar, +# :normalize, :weights, +# :contours, :aspect_ratio, + :match_dimensions, +# :clims, +# :inset_subplots, + :dpi, +# :colorbar_title, + ]) +const _inspectdr_style = [:auto, :solid, :dash, :dot, :dashdot] +const _inspectdr_seriestype = [ + :path, :scatter, :shape, :straightline, #, :steppre, :steppost + ] +#see: _allMarkers, _shape_keys +const _inspectdr_marker = Symbol[ + :none, :auto, + :circle, :rect, :diamond, + :cross, :xcross, + :utriangle, :dtriangle, :rtriangle, :ltriangle, + :pentagon, :hexagon, :heptagon, :octagon, + :star4, :star5, :star6, :star7, :star8, + :vline, :hline, :+, :x, +] + +const _inspectdr_scale = [:identity, :ln, :log2, :log10] diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index 72288380..72f7c74e 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -9,53 +9,7 @@ TODO * fix units in all visuals (e.g dotted lines, marker scale, surfaces) =# -const _glvisualize_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :titlefontsize, :titlefontcolor, - :legendfontsize, :legendfontcolor, - :tickfontsize, - :guidefontsize, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :colorbar, - :marker_z, - :line_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - #:polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :hover, - :framestyle, - :tick_direction, -]) -const _glvisualize_seriestype = [ - :path, :shape, :straightline, - :scatter, :hexbin, - :bar, :boxplot, - :heatmap, :image, :volume, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe -] -const _glvisualize_style = [:auto, :solid, :dash, :dot, :dashdot] -const _glvisualize_marker = _allMarkers -const _glvisualize_scale = [:identity, :ln, :log2, :log10] + slice_arg(img::Matrix{C}, idx::Int) where {C<:Colorant} = img is_marker_supported(::GLVisualizeBackend, shape::GLVisualize.AllPrimitives) = true diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 2534e5f2..891434a1 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -3,65 +3,6 @@ # significant contributions by @jheinen -const _gr_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_legend, :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, - :layout, - :title, :window_title, - :guide, :lims, :ticks, :scale, :flip, - :match_dimensions, - :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, - :titlefontrotation, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfonthalign, :legendfontvalign, - :legendfontrotation, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign, - :tickfontrotation, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign, - :guidefontrotation, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :legendtitle, :colorbar, :colorbar_title, - :fill_z, :line_z, :marker_z, :levels, - :ribbon, :quiver, - :orientation, - :overwrite_figure, - :polar, - :aspect_ratio, - :normalize, :weights, - :inset_subplots, - :bar_width, - :arrow, - :framestyle, - :tick_direction, - :camera, - :contour_labels, -]) -const _gr_seriestype = [ - :path, :scatter, :straightline, - :heatmap, :pie, :image, - :contour, :path3d, :scatter3d, :surface, :wireframe, - :shape -] -const _gr_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -const _gr_marker = _allMarkers -const _gr_scale = [:identity, :log10] -is_marker_supported(::GRBackend, shape::Shape) = true - -function add_backend_string(::GRBackend) - """ - Pkg.add("GR") - Pkg.build("GR") - """ -end - import GR export GR diff --git a/src/backends/hdf5.jl b/src/backends/hdf5.jl index 28dd767d..95b83874 100644 --- a/src/backends/hdf5.jl +++ b/src/backends/hdf5.jl @@ -62,47 +62,6 @@ const HDF5PLOT_SIMPLESUBSTRUCT = Union{Font, BoundingBox, #== ===============================================================================# - -const _hdf5_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, :titlefont, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :legend, :colorbar, - :marker_z, :line_z, :fill_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - :polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :colorbar_title, - ]) -const _hdf5_seriestype = [ - :path, :steppre, :steppost, :shape, :straightline, - :scatter, :hexbin, #:histogram2d, :histogram, - # :bar, - :heatmap, :pie, :image, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe - ] -const _hdf5_style = [:auto, :solid, :dash, :dot, :dashdot] -const _hdf5_marker = vcat(_allMarkers, :pixel) -const _hdf5_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::HDF5Backend, shape::Shape) = true if length(HDF5PLOT_MAP_TELEM2STR) < 1 diff --git a/src/backends/inspectdr.jl b/src/backends/inspectdr.jl index 5825630f..8ef26f90 100644 --- a/src/backends/inspectdr.jl +++ b/src/backends/inspectdr.jl @@ -14,59 +14,6 @@ Add in functionality to Plots.jl: =# # --------------------------------------------------------------------------- -#TODO: remove features -const _inspectdr_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - # :foreground_color_grid, - :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :markerstrokestyle, #Causes warning not to have it... what is this? - :fillcolor, :fillalpha, #:fillrange, -# :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, - :window_title, - :guide, :lims, :scale, #:ticks, :flip, :rotation, - :titlefontfamily, :titlefontsize, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :grid, :legend, #:colorbar, -# :marker_z, -# :line_z, -# :levels, - # :ribbon, :quiver, :arrow, -# :orientation, - :overwrite_figure, - :polar, -# :normalize, :weights, -# :contours, :aspect_ratio, - :match_dimensions, -# :clims, -# :inset_subplots, - :dpi, -# :colorbar_title, - ]) -const _inspectdr_style = [:auto, :solid, :dash, :dot, :dashdot] -const _inspectdr_seriestype = [ - :path, :scatter, :shape, :straightline, #, :steppre, :steppost - ] -#see: _allMarkers, _shape_keys -const _inspectdr_marker = Symbol[ - :none, :auto, - :circle, :rect, :diamond, - :cross, :xcross, - :utriangle, :dtriangle, :rtriangle, :ltriangle, - :pentagon, :hexagon, :heptagon, :octagon, - :star4, :star5, :star6, :star7, :star8, - :vline, :hline, :+, :x, -] - -const _inspectdr_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::InspectDRBackend, shape::Shape) = true diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index b3480a9b..9cca4703 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -2,47 +2,6 @@ # significant contributions by: @pkofod -const _pgfplots_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, - :background_color_inside, - # :background_color_outside, - # :foreground_color_legend, - :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, - :fillrange, :fillcolor, :fillalpha, - :bins, - # :bar_width, :bar_edges, - :title, - # :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :legend, - :colorbar, :colorbar_title, - :fill_z, :line_z, :marker_z, :levels, - # :ribbon, :quiver, :arrow, - # :orientation, - # :overwrite_figure, - :polar, - # :normalize, :weights, :contours, - :aspect_ratio, - # :match_dimensions, - :tick_direction, - :framestyle, - :camera, - :contour_labels, - ]) -const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] -const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon, :hline] #vcat(_allMarkers, Shape) -const _pgfplots_scale = [:identity, :ln, :log2, :log10] - - # -------------------------------------------------------------------------------------- const _pgfplots_linestyles = KW( diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 3e525b5b..2cba0061 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -1,60 +1,6 @@ # https://plot.ly/javascript/getting-started -const _plotly_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_legend, :foreground_color_guide, - :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :foreground_color_title, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, - :fillrange, :fillcolor, :fillalpha, - :bins, - :title, :title_location, - :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, - :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :gridalpha, :gridlinewidth, - :legend, :colorbar, :colorbar_title, - :marker_z, :fill_z, :line_z, :levels, - :ribbon, :quiver, - :orientation, - # :overwrite_figure, - :polar, - :normalize, :weights, - # :contours, - :aspect_ratio, - :hover, - :inset_subplots, - :bar_width, - :clims, - :framestyle, - :tick_direction, - :camera, - :contour_labels, - ]) - -const _plotly_seriestype = [ - :path, :scatter, :pie, :heatmap, - :contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl, - :straightline -] -const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot] -const _plotly_marker = [ - :none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, - :cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline -] -const _plotly_scale = [:identity, :log10] is_subplot_supported(::PlotlyBackend) = true # is_string_supported(::PlotlyBackend) = true const _plotly_framestyles = [:box, :axes, :zerolines, :grid, :none] diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 6e06ce71..c77800dc 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -1,12 +1,6 @@ # https://github.com/spencerlyon2/PlotlyJS.jl -const _plotlyjs_attr = _plotly_attr -const _plotlyjs_seriestype = _plotly_seriestype -const _plotlyjs_style = _plotly_style -const _plotlyjs_marker = _plotly_marker -const _plotlyjs_scale = _plotly_scale - # -------------------------------------------------------------------------------------- diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 4d171847..b1467639 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1,55 +1,6 @@ # https://github.com/stevengj/PyPlot.jl -const _pyplot_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, :titlefont, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :titlefontfamily, :titlefontsize, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :legendtitle, :colorbar, - :marker_z, :line_z, :fill_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - :polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :colorbar_title, - :stride, - :framestyle, - :tick_direction, - :camera, - :contour_labels, - ]) -const _pyplot_seriestype = [ - :path, :steppre, :steppost, :shape, :straightline, - :scatter, :hexbin, #:histogram2d, :histogram, - # :bar, - :heatmap, :pie, :image, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe - ] -const _pyplot_style = [:auto, :solid, :dash, :dot, :dashdot] -const _pyplot_marker = vcat(_allMarkers, :pixel) -const _pyplot_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::PyPlotBackend, shape::Shape) = true diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index afdd08cc..370c9a87 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -1,28 +1,6 @@ # https://github.com/Evizero/UnicodePlots.jl -const _unicodeplots_attr = merge_with_base_supported([ - :label, - :legend, - :seriescolor, - :seriesalpha, - :linestyle, - :markershape, - :bins, - :title, - :guide, :lims, - ]) -const _unicodeplots_seriestype = [ - :path, :scatter, :straightline, - # :bar, - :shape, - :histogram2d, - :spy -] -const _unicodeplots_style = [:auto, :solid] -const _unicodeplots_marker = [:none, :auto, :circle] -const _unicodeplots_scale = [:identity] - # don't warn on unsupported... there's just too many warnings!! warnOnUnsupported_args(::UnicodePlotsBackend, plotattributes::KW) = nothing diff --git a/src/examples.jl b/src/examples.jl index e9155d0e..a53707d9 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -437,6 +437,14 @@ each line segment or marker in the plot. ] +# Some constants for PlotDocs and PlotReferenceImages +_animation_examples = [2, 30] +_backend_skips = Dict( + :gr => [25, 30], + :pyplot => [25, 30], + :plotlyjs => [2, 21, 25, 30, 31], +) + # --------------------------------------------------------------------------------- # make and display one plot diff --git a/test/add_packages.jl b/test/add_packages.jl index 1b143c46..954fecb1 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -24,13 +24,13 @@ if isinteractive() PackageSpec(name="VisualRegressionTests"), PackageSpec(name="Gtk"), # PlotlyJS: - # PackageSpec(name="PlotlyJS", rev="master"), - # PackageSpec(name="Blink"), - # PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + PackageSpec(name="PlotlyJS", rev="master"), + PackageSpec(name="Blink"), + PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), # PyPlot: - # PackageSpec(name="PyPlot"), - # PackageSpec(name="PyCall"), - # PackageSpec(name="LaTeXStrings"), + PackageSpec(name="PyPlot"), + PackageSpec(name="PyCall"), + PackageSpec(name="LaTeXStrings"), ]) else push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) diff --git a/test/runtests.jl b/test/runtests.jl index 43ffdac4..62dc73e1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,25 +14,25 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 @test gr() == Plots.GRBackend() @test backend() == Plots.GRBackend() - image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) + # image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end -# @static if isinteractive() -# @testset "PyPlot" begin -# @test pyplot() == Plots.PyPlotBackend() -# @test backend() == Plots.PyPlotBackend() -# -# image_comparison_facts(:pyplot, tol=img_tol, skip = [25, 30]) -# end -# end +@static if isinteractive() + @testset "PyPlot" begin + @test pyplot() == Plots.PyPlotBackend() + @test backend() == Plots.PyPlotBackend() -# @testset "UnicodePlots" begin -# @test unicodeplots() == Plots.UnicodePlotsBackend() -# @test backend() == Plots.UnicodePlotsBackend() -# -# # lets just make sure it runs without error -# @test isa(plot(rand(10)), Plots.Plot) == true -# end + image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) + end +end + +@testset "UnicodePlots" begin + @test unicodeplots() == Plots.UnicodePlotsBackend() + @test backend() == Plots.UnicodePlotsBackend() + + # lets just make sure it runs without error + @test isa(plot(rand(10)), Plots.Plot) == true +end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) From 5f5019d31015c3b849db4dfe2210d75789e09ee3 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:04:44 +0200 Subject: [PATCH 04/19] fix plotlyjs (fix #1728) --- src/backends.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index c6ecaf2a..17b9f1c9 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -580,8 +580,7 @@ end function add_backend_string(::PlotlyJSBackend) """ using Pkg - Pkg.add(["PlotlyJS", "Blink"]) - Pkg.add(PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master")) + Pkg.add(["PlotlyJS", "Blink", "ORCA"]) import Blink Blink.AtomShell.install() """ From 192020a93af68a4e43819891a46fbe962c118065 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:08:32 +0200 Subject: [PATCH 05/19] skip visual regression tests on windows --- test/runtests.jl | 52 +++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 62dc73e1..f98f877c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,18 +14,20 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 @test gr() == Plots.GRBackend() @test backend() == Plots.GRBackend() - # image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) -end - -@static if isinteractive() - @testset "PyPlot" begin - @test pyplot() == Plots.PyPlotBackend() - @test backend() == Plots.PyPlotBackend() - - image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) + @static if Sys.islinux() + image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end end +# @static if isinteractive() +# @testset "PyPlot" begin +# @test pyplot() == Plots.PyPlotBackend() +# @test backend() == Plots.PyPlotBackend() +# +# image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) +# end +# end + @testset "UnicodePlots" begin @test unicodeplots() == Plots.UnicodePlotsBackend() @test backend() == Plots.UnicodePlotsBackend() @@ -37,22 +39,22 @@ end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) -@static if isinteractive() - @testset "PlotlyJS" begin - @test plotlyjs() == Plots.PlotlyJSBackend() - @test backend() == Plots.PlotlyJSBackend() - - image_comparison_facts(:plotlyjs, - skip=[ - 2, # animation (skipped for speed) - 25, - 27, # (polar plots) takes very long / not working - 30, - 31, # animation (skipped for speed) - ], - tol=img_tol) - end -end +# @static if isinteractive() +# @testset "PlotlyJS" begin +# @test plotlyjs() == Plots.PlotlyJSBackend() +# @test backend() == Plots.PlotlyJSBackend() +# +# image_comparison_facts(:plotlyjs, +# skip=[ +# 2, # animation (skipped for speed) +# 25, +# 27, # (polar plots) takes very long / not working +# 30, +# 31, # animation (skipped for speed) +# ], +# tol=img_tol) +# end +# end # InspectDR returns that error on travis: # ERROR: LoadError: InitError: Cannot open display: From 59e7213c96464ba80098eb36406e86b3f76c7475 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:30:42 +0200 Subject: [PATCH 06/19] one more fix for plotlyjs --- src/backends/plotlyjs.jl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index c77800dc..791016d7 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -6,10 +6,7 @@ function _create_backend_figure(plt::Plot{PlotlyJSBackend}) if !isplotnull() && plt[:overwrite_figure] && isa(current().o, PlotlyJS.SyncPlot) - PlotlyJS.SyncPlot(PlotlyJS.Plot(), - events = current().o.events, - options = current().o.options, - ) + PlotlyJS.SyncPlot(PlotlyJS.Plot(), options = current().o.options) else PlotlyJS.plot() end From fc51c355a5c1db860ae18146a33f17f784031a4b Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:53:32 +0200 Subject: [PATCH 07/19] don't add PyPlot and PlotlyJS in tests --- test/add_packages.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/add_packages.jl b/test/add_packages.jl index 954fecb1..4e27bb30 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -24,13 +24,13 @@ if isinteractive() PackageSpec(name="VisualRegressionTests"), PackageSpec(name="Gtk"), # PlotlyJS: - PackageSpec(name="PlotlyJS", rev="master"), - PackageSpec(name="Blink"), - PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + # PackageSpec(name="PlotlyJS"), + # PackageSpec(name="Blink"), + # PackageSpec(name="ORCA"), # PyPlot: - PackageSpec(name="PyPlot"), - PackageSpec(name="PyCall"), - PackageSpec(name="LaTeXStrings"), + # PackageSpec(name="PyPlot"), + # PackageSpec(name="PyCall"), + # PackageSpec(name="LaTeXStrings"), ]) else push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) From 87c471c0f5ea0b409f5d88b6d64d5d8f80882472 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 2 Sep 2018 22:28:34 +0200 Subject: [PATCH 08/19] plotlyjs, pyplot and test fixes --- src/backends.jl | 22 +++++++--------- src/backends/plotlyjs.jl | 5 +++- src/backends/pyplot.jl | 2 +- test/add_packages.jl | 13 +++++++++- test/runtests.jl | 56 +++++++++++++++++++++------------------- 5 files changed, 56 insertions(+), 42 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 9a5a7e1c..4a3aa4f2 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -347,16 +347,6 @@ function _initialize_backend(::GLVisualizeBackend; kw...) end end -# ------------------------------------------------------------------------------ -# hdf5 - -function _initialize_backend(::HDF5Backend) - @eval Main begin - import HDF5 - export HDF5 - end -end - # ------------------------------------------------------------------------------ # PGFPLOTS @@ -371,11 +361,19 @@ end # ------------------------------------------------------------------------------ # plotlyjs +function _initialize_backend(pkg::PlotlyJSBackend) + sym = backend_package_name(pkg) + @eval Main begin + import PlotlyJS, ORCA + export PlotlyJS + end +end + function add_backend_string(::PlotlyJSBackend) """ using Pkg - Pkg.add("PlotlyJS") - Pkg.add("Rsvg") + Pkg.add(["PlotlyJS", "Blink"]) + Pkg.add(PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master")) import Blink Blink.AtomShell.install() """ diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 98e626c1..6e06ce71 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -12,7 +12,10 @@ const _plotlyjs_scale = _plotly_scale function _create_backend_figure(plt::Plot{PlotlyJSBackend}) if !isplotnull() && plt[:overwrite_figure] && isa(current().o, PlotlyJS.SyncPlot) - PlotlyJS.SyncPlot(PlotlyJS.Plot(), current().o.view) + PlotlyJS.SyncPlot(PlotlyJS.Plot(), + events = current().o.events, + options = current().o.options, + ) else PlotlyJS.plot() end diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 4524e967..4933406d 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1064,7 +1064,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) ticks = sp[:framestyle] == :none ? nothing : get_ticks(axis) # don't show the 0 tick label for the origin framestyle if sp[:framestyle] == :origin && length(ticks) > 1 - ticks[2][ticks[1] .== 0] = "" + ticks[2][ticks[1] .== 0] .= "" end axis[:ticks] != :native ? py_set_ticks(ax, ticks, letter) : nothing pyaxis[:set_tick_params](direction = axis[:tick_direction] == :out ? "out" : "in") diff --git a/test/add_packages.jl b/test/add_packages.jl index 260707d3..1b143c46 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -4,7 +4,6 @@ using Pkg # ENV["PYTHON"] = "" to_add = [ - PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git"), # PackageSpec(url="https://github.com/JuliaStats/KernelDensity.jl.git"), PackageSpec(name="PlotUtils", rev="master"), PackageSpec(name="RecipesBase", rev="master"), @@ -17,12 +16,24 @@ to_add = [ ] if isinteractive() + Pkg.develop(PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) append!(to_add, [ PackageSpec(name="FileIO"), PackageSpec(name="ImageMagick"), PackageSpec(name="UnicodePlots"), PackageSpec(name="VisualRegressionTests"), + PackageSpec(name="Gtk"), + # PlotlyJS: + # PackageSpec(name="PlotlyJS", rev="master"), + # PackageSpec(name="Blink"), + # PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + # PyPlot: + # PackageSpec(name="PyPlot"), + # PackageSpec(name="PyCall"), + # PackageSpec(name="LaTeXStrings"), ]) +else + push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) end Pkg.add(to_add) diff --git a/test/runtests.jl b/test/runtests.jl index 543b8ea3..43ffdac4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,40 +17,42 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end - -#@testset "PyPlot" begin -# @test pyplot() == Plots.PyPlotBackend() -# @test backend() == Plots.PyPlotBackend() +# @static if isinteractive() +# @testset "PyPlot" begin +# @test pyplot() == Plots.PyPlotBackend() +# @test backend() == Plots.PyPlotBackend() # -# image_comparison_facts(:pyplot, tol=img_tol) -#end +# image_comparison_facts(:pyplot, tol=img_tol, skip = [25, 30]) +# end +# end -@testset "UnicodePlots" begin - @test unicodeplots() == Plots.UnicodePlotsBackend() - @test backend() == Plots.UnicodePlotsBackend() - - # lets just make sure it runs without error - @test isa(plot(rand(10)), Plots.Plot) == true -end +# @testset "UnicodePlots" begin +# @test unicodeplots() == Plots.UnicodePlotsBackend() +# @test backend() == Plots.UnicodePlotsBackend() +# +# # lets just make sure it runs without error +# @test isa(plot(rand(10)), Plots.Plot) == true +# end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) -# @testset "PlotlyJS" begin -# @test plotlyjs() == Plots.PlotlyJSBackend() -# @test backend() == Plots.PlotlyJSBackend() -# -# if Sys.islinux() && isinteractive() -# image_comparison_facts(:plotlyjs, -# skip=[ -# 2, # animation (skipped for speed) -# 27, # (polar plots) takes very long / not working -# 31, # animation (skipped for speed) -# ], -# tol=img_tol) -# end -# end +@static if isinteractive() + @testset "PlotlyJS" begin + @test plotlyjs() == Plots.PlotlyJSBackend() + @test backend() == Plots.PlotlyJSBackend() + image_comparison_facts(:plotlyjs, + skip=[ + 2, # animation (skipped for speed) + 25, + 27, # (polar plots) takes very long / not working + 30, + 31, # animation (skipped for speed) + ], + tol=img_tol) + end +end # InspectDR returns that error on travis: # ERROR: LoadError: InitError: Cannot open display: From 31004e8c128e757588b93250211786bbdba4ef9e Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 3 Sep 2018 17:30:50 +0200 Subject: [PATCH 09/19] move _current_plots_version from PlotDocs to Plots --- src/Plots.jl | 2 ++ test/imgcomp.jl | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/Plots.jl b/src/Plots.jl index 35b16001..f09115e5 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -1,5 +1,7 @@ module Plots +_current_plots_version = v"0.20.1" + using Reexport import StaticArrays diff --git a/test/imgcomp.jl b/test/imgcomp.jl index f52e5a38..64bfbeb2 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -29,7 +29,11 @@ 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) +<<<<<<< HEAD const _current_plots_version = v"0.20.3" +======= +import Plots._current_plots_version +>>>>>>> move _current_plots_version from PlotDocs to Plots function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], tol = 1e-2) From a72a23b5483a7b2eba98ee2b06abfee0b3b403b7 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Tue, 4 Sep 2018 19:08:48 +0200 Subject: [PATCH 10/19] move supported backend attr to backends.jl --- src/backends.jl | 390 ++++++++++++++++++++++++++++++++++- src/backends/glvisualize.jl | 48 +---- src/backends/gr.jl | 59 ------ src/backends/hdf5.jl | 41 ---- src/backends/inspectdr.jl | 55 ----- src/backends/pgfplots.jl | 41 ---- src/backends/plotly.jl | 54 ----- src/backends/plotlyjs.jl | 6 - src/backends/pyplot.jl | 49 ----- src/backends/unicodeplots.jl | 22 -- src/examples.jl | 8 + test/add_packages.jl | 12 +- test/runtests.jl | 32 +-- 13 files changed, 420 insertions(+), 397 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 4a3aa4f2..8046d16e 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -330,6 +330,126 @@ function add_backend_string(pkg::AbstractBackend) """ end +# ------------------------------------------------------------------------------ +# gr + +const _gr_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_legend, :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, + :layout, + :title, :window_title, + :guide, :lims, :ticks, :scale, :flip, + :match_dimensions, + :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, + :titlefontrotation, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfonthalign, :legendfontvalign, + :legendfontrotation, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign, + :tickfontrotation, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign, + :guidefontrotation, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :legendtitle, :colorbar, :colorbar_title, + :fill_z, :line_z, :marker_z, :levels, + :ribbon, :quiver, + :orientation, + :overwrite_figure, + :polar, + :aspect_ratio, + :normalize, :weights, + :inset_subplots, + :bar_width, + :arrow, + :framestyle, + :tick_direction, + :camera, + :contour_labels, +]) +const _gr_seriestype = [ + :path, :scatter, :straightline, + :heatmap, :pie, :image, + :contour, :path3d, :scatter3d, :surface, :wireframe, + :shape +] +const _gr_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] +const _gr_marker = _allMarkers +const _gr_scale = [:identity, :log10] +is_marker_supported(::GRBackend, shape::Shape) = true + +function add_backend_string(::GRBackend) + """ + Pkg.add("GR") + Pkg.build("GR") + """ +end + +# ------------------------------------------------------------------------------ +# plotly + +const _plotly_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_legend, :foreground_color_guide, + :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :foreground_color_title, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, + :fillrange, :fillcolor, :fillalpha, + :bins, + :title, :title_location, + :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, + :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :gridalpha, :gridlinewidth, + :legend, :colorbar, :colorbar_title, + :marker_z, :fill_z, :line_z, :levels, + :ribbon, :quiver, + :orientation, + # :overwrite_figure, + :polar, + :normalize, :weights, + # :contours, + :aspect_ratio, + :hover, + :inset_subplots, + :bar_width, + :clims, + :framestyle, + :tick_direction, + :camera, + :contour_labels, + ]) + +const _plotly_seriestype = [ + :path, :scatter, :pie, :heatmap, + :contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl, + :straightline +] +const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot] +const _plotly_marker = [ + :none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, + :cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline +] +const _plotly_scale = [:identity, :log10] + # ------------------------------------------------------------------------------ # glvisualize @@ -347,8 +467,56 @@ function _initialize_backend(::GLVisualizeBackend; kw...) end end +const _glvisualize_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :titlefontsize, :titlefontcolor, + :legendfontsize, :legendfontcolor, + :tickfontsize, + :guidefontsize, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :colorbar, + :marker_z, + :line_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + #:polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :hover, + :framestyle, + :tick_direction, +]) +const _glvisualize_seriestype = [ + :path, :shape, :straightline, + :scatter, :hexbin, + :bar, :boxplot, + :heatmap, :image, :volume, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe +] +const _glvisualize_style = [:auto, :solid, :dash, :dot, :dashdot] +const _glvisualize_marker = _allMarkers +const _glvisualize_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ -# PGFPLOTS +# pgfplots function add_backend_string(::PGFPlotsBackend) """ @@ -358,6 +526,45 @@ function add_backend_string(::PGFPlotsBackend) """ end +:annotations, +:background_color_legend, +:background_color_inside, +# :background_color_outside, +# :foreground_color_legend, +:foreground_color_grid, :foreground_color_axis, +:foreground_color_text, :foreground_color_border, +:label, +:seriescolor, :seriesalpha, +:linecolor, :linestyle, :linewidth, :linealpha, +:markershape, :markercolor, :markersize, :markeralpha, +:markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, +:fillrange, :fillcolor, :fillalpha, +:bins, +# :bar_width, :bar_edges, +:title, +# :window_title, +:guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, +:tickfont, :guidefont, :legendfont, +:grid, :legend, +:colorbar, :colorbar_title, +:fill_z, :line_z, :marker_z, :levels, +# :ribbon, :quiver, :arrow, +# :orientation, +# :overwrite_figure, +:polar, +# :normalize, :weights, :contours, +:aspect_ratio, +# :match_dimensions, +:tick_direction, +:framestyle, +:camera, +:contour_labels, +]) +const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] +const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] +const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon, :hline] #vcat(_allMarkers, Shape) +const _pgfplots_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ # plotlyjs @@ -379,6 +586,12 @@ function add_backend_string(::PlotlyJSBackend) """ end +const _plotlyjs_attr = _plotly_attr +const _plotlyjs_seriestype = _plotly_seriestype +const _plotlyjs_style = _plotly_style +const _plotlyjs_marker = _plotly_marker +const _plotlyjs_scale = _plotly_scale + # ------------------------------------------------------------------------------ # pyplot @@ -407,8 +620,59 @@ function add_backend_string(::PyPlotBackend) """ end +const _pyplot_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, :titlefont, + :window_title, + :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, + :titlefontfamily, :titlefontsize, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :grid, :gridalpha, :gridstyle, :gridlinewidth, + :legend, :legendtitle, :colorbar, + :marker_z, :line_z, :fill_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + :polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :colorbar_title, + :stride, + :framestyle, + :tick_direction, + :camera, + :contour_labels, + ]) +const _pyplot_seriestype = [ + :path, :steppre, :steppost, :shape, :straightline, + :scatter, :hexbin, #:histogram2d, :histogram, + # :bar, + :heatmap, :pie, :image, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe + ] +const _pyplot_style = [:auto, :solid, :dash, :dot, :dashdot] +const _pyplot_marker = vcat(_allMarkers, :pixel) +const _pyplot_scale = [:identity, :ln, :log2, :log10] + # ------------------------------------------------------------------------------ # unicodeplots + function add_backend_string(::UnicodePlotsBackend) """ using Pkg @@ -416,3 +680,127 @@ function add_backend_string(::UnicodePlotsBackend) Pkg.build("UnicodePlots") """ end + +const _unicodeplots_attr = merge_with_base_supported([ + :label, + :legend, + :seriescolor, + :seriesalpha, + :linestyle, + :markershape, + :bins, + :title, + :guide, :lims, + ]) +const _unicodeplots_seriestype = [ + :path, :scatter, :straightline, + # :bar, + :shape, + :histogram2d, + :spy +] +const _unicodeplots_style = [:auto, :solid] +const _unicodeplots_marker = [:none, :auto, :circle] +const _unicodeplots_scale = [:identity] + +# ------------------------------------------------------------------------------ +# hdf5 + +const _hdf5_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + :foreground_color_grid, :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :fillrange, :fillcolor, :fillalpha, + :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, :titlefont, + :window_title, + :guide, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :legend, :colorbar, + :marker_z, :line_z, :fill_z, + :levels, + :ribbon, :quiver, :arrow, + :orientation, + :overwrite_figure, + :polar, + :normalize, :weights, + :contours, :aspect_ratio, + :match_dimensions, + :clims, + :inset_subplots, + :dpi, + :colorbar_title, + ]) +const _hdf5_seriestype = [ + :path, :steppre, :steppost, :shape, :straightline, + :scatter, :hexbin, #:histogram2d, :histogram, + # :bar, + :heatmap, :pie, :image, + :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe + ] +const _hdf5_style = [:auto, :solid, :dash, :dot, :dashdot] +const _hdf5_marker = vcat(_allMarkers, :pixel) +const _hdf5_scale = [:identity, :ln, :log2, :log10] + +# ------------------------------------------------------------------------------ +# inspectdr + +const _inspectdr_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, :background_color_inside, :background_color_outside, + # :foreground_color_grid, + :foreground_color_legend, :foreground_color_title, + :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, + :markerstrokestyle, #Causes warning not to have it... what is this? + :fillcolor, :fillalpha, #:fillrange, +# :bins, :bar_width, :bar_edges, :bar_position, + :title, :title_location, + :window_title, + :guide, :lims, :scale, #:ticks, :flip, :rotation, + :titlefontfamily, :titlefontsize, :titlefontcolor, + :legendfontfamily, :legendfontsize, :legendfontcolor, + :tickfontfamily, :tickfontsize, :tickfontcolor, + :guidefontfamily, :guidefontsize, :guidefontcolor, + :grid, #:gridalpha, :gridstyle, :gridlinewidth, #alhpa & linewidth are per plot - not per subplot + :legend, #:legendtitle, :colorbar, +# :marker_z, +# :line_z, +# :levels, + # :ribbon, :quiver, :arrow, +# :orientation, + :overwrite_figure, + :polar, +# :normalize, :weights, +# :contours, :aspect_ratio, + :match_dimensions, +# :clims, +# :inset_subplots, + :dpi, +# :colorbar_title, + ]) +const _inspectdr_style = [:auto, :solid, :dash, :dot, :dashdot] +const _inspectdr_seriestype = [ + :path, :scatter, :shape, :straightline, #, :steppre, :steppost + ] +#see: _allMarkers, _shape_keys +const _inspectdr_marker = Symbol[ + :none, :auto, + :circle, :rect, :diamond, + :cross, :xcross, + :utriangle, :dtriangle, :rtriangle, :ltriangle, + :pentagon, :hexagon, :heptagon, :octagon, + :star4, :star5, :star6, :star7, :star8, + :vline, :hline, :+, :x, +] + +const _inspectdr_scale = [:identity, :ln, :log2, :log10] diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl index 72288380..72f7c74e 100644 --- a/src/backends/glvisualize.jl +++ b/src/backends/glvisualize.jl @@ -9,53 +9,7 @@ TODO * fix units in all visuals (e.g dotted lines, marker scale, surfaces) =# -const _glvisualize_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :titlefontsize, :titlefontcolor, - :legendfontsize, :legendfontcolor, - :tickfontsize, - :guidefontsize, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :colorbar, - :marker_z, - :line_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - #:polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :hover, - :framestyle, - :tick_direction, -]) -const _glvisualize_seriestype = [ - :path, :shape, :straightline, - :scatter, :hexbin, - :bar, :boxplot, - :heatmap, :image, :volume, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe -] -const _glvisualize_style = [:auto, :solid, :dash, :dot, :dashdot] -const _glvisualize_marker = _allMarkers -const _glvisualize_scale = [:identity, :ln, :log2, :log10] + slice_arg(img::Matrix{C}, idx::Int) where {C<:Colorant} = img is_marker_supported(::GLVisualizeBackend, shape::GLVisualize.AllPrimitives) = true diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 267875f9..67996895 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -3,65 +3,6 @@ # significant contributions by @jheinen -const _gr_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_legend, :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, - :layout, - :title, :window_title, - :guide, :guide_position, :lims, :ticks, :scale, :flip, - :match_dimensions, - :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, - :titlefontrotation, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfonthalign, :legendfontvalign, - :legendfontrotation, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfonthalign, :tickfontvalign, - :tickfontrotation, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefonthalign, :guidefontvalign, - :guidefontrotation, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :legendtitle, :colorbar, :colorbar_title, - :fill_z, :line_z, :marker_z, :levels, - :ribbon, :quiver, - :orientation, - :overwrite_figure, - :polar, - :aspect_ratio, - :normalize, :weights, - :inset_subplots, - :bar_width, - :arrow, - :framestyle, - :tick_direction, - :camera, - :contour_labels, -]) -const _gr_seriestype = [ - :path, :scatter, :straightline, - :heatmap, :pie, :image, - :contour, :path3d, :scatter3d, :surface, :wireframe, - :shape -] -const _gr_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -const _gr_marker = _allMarkers -const _gr_scale = [:identity, :log10] -is_marker_supported(::GRBackend, shape::Shape) = true - -function add_backend_string(::GRBackend) - """ - Pkg.add("GR") - Pkg.build("GR") - """ -end - import GR export GR diff --git a/src/backends/hdf5.jl b/src/backends/hdf5.jl index 28dd767d..95b83874 100644 --- a/src/backends/hdf5.jl +++ b/src/backends/hdf5.jl @@ -62,47 +62,6 @@ const HDF5PLOT_SIMPLESUBSTRUCT = Union{Font, BoundingBox, #== ===============================================================================# - -const _hdf5_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, :titlefont, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :legend, :colorbar, - :marker_z, :line_z, :fill_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - :polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :colorbar_title, - ]) -const _hdf5_seriestype = [ - :path, :steppre, :steppost, :shape, :straightline, - :scatter, :hexbin, #:histogram2d, :histogram, - # :bar, - :heatmap, :pie, :image, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe - ] -const _hdf5_style = [:auto, :solid, :dash, :dot, :dashdot] -const _hdf5_marker = vcat(_allMarkers, :pixel) -const _hdf5_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::HDF5Backend, shape::Shape) = true if length(HDF5PLOT_MAP_TELEM2STR) < 1 diff --git a/src/backends/inspectdr.jl b/src/backends/inspectdr.jl index 56fd7f32..bbc268a3 100644 --- a/src/backends/inspectdr.jl +++ b/src/backends/inspectdr.jl @@ -14,61 +14,6 @@ Add in functionality to Plots.jl: =# # --------------------------------------------------------------------------- -#TODO: remove features -const _inspectdr_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - # :foreground_color_grid, - :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :markerstrokestyle, #Causes warning not to have it... what is this? - :fillcolor, :fillalpha, #:fillrange, -# :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, - :window_title, - :guide, :lims, :scale, #:ticks, :flip, :rotation, - :titlefontfamily, :titlefontsize, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :grid, #:gridalpha, :gridstyle, :gridlinewidth, #alhpa & linewidth are per plot - not per subplot - :legend, #:legendtitle, :colorbar, -# :marker_z, -# :line_z, -# :levels, - # :ribbon, :quiver, :arrow, -# :orientation, - :overwrite_figure, - :polar, -# :normalize, :weights, -# :contours, :aspect_ratio, - :match_dimensions, -# :clims, -# :inset_subplots, - :dpi, -# :colorbar_title, - ]) -const _inspectdr_style = [:auto, :solid, :dash, :dot, :dashdot] -const _inspectdr_seriestype = [ - :path, :scatter, :shape, :straightline, #, :steppre, :steppost - ] -#see: _allMarkers, _shape_keys -const _inspectdr_marker = Symbol[ - :none, :auto, - :circle, :rect, :diamond, - :cross, :xcross, - :utriangle, :dtriangle, :rtriangle, :ltriangle, - :pentagon, :hexagon, :heptagon, :octagon, - :star4, :star5, :star6, :star7, :star8, - :vline, :hline, :+, :x, -] - -const _inspectdr_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::InspectDRBackend, shape::Shape) = true diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl index 26865bb9..9b351175 100644 --- a/src/backends/pgfplots.jl +++ b/src/backends/pgfplots.jl @@ -2,47 +2,6 @@ # significant contributions by: @pkofod -const _pgfplots_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, - :background_color_inside, - # :background_color_outside, - # :foreground_color_legend, - :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, - :fillrange, :fillcolor, :fillalpha, - :bins, - # :bar_width, :bar_edges, - :title, - # :window_title, - :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :legend, - :colorbar, :colorbar_title, - :fill_z, :line_z, :marker_z, :levels, - # :ribbon, :quiver, :arrow, - # :orientation, - # :overwrite_figure, - :polar, - # :normalize, :weights, :contours, - :aspect_ratio, - # :match_dimensions, - :tick_direction, - :framestyle, - :camera, - :contour_labels, - ]) -const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] -const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] -const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon, :hline] #vcat(_allMarkers, Shape) -const _pgfplots_scale = [:identity, :ln, :log2, :log10] - - # -------------------------------------------------------------------------------------- const _pgfplots_linestyles = KW( diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 3e525b5b..2cba0061 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -1,60 +1,6 @@ # https://plot.ly/javascript/getting-started -const _plotly_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_legend, :foreground_color_guide, - :foreground_color_grid, :foreground_color_axis, - :foreground_color_text, :foreground_color_border, - :foreground_color_title, - :label, - :seriescolor, :seriesalpha, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, - :fillrange, :fillcolor, :fillalpha, - :bins, - :title, :title_location, - :titlefontfamily, :titlefontsize, :titlefonthalign, :titlefontvalign, - :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :window_title, - :guide, :lims, :ticks, :scale, :flip, :rotation, - :tickfont, :guidefont, :legendfont, - :grid, :gridalpha, :gridlinewidth, - :legend, :colorbar, :colorbar_title, - :marker_z, :fill_z, :line_z, :levels, - :ribbon, :quiver, - :orientation, - # :overwrite_figure, - :polar, - :normalize, :weights, - # :contours, - :aspect_ratio, - :hover, - :inset_subplots, - :bar_width, - :clims, - :framestyle, - :tick_direction, - :camera, - :contour_labels, - ]) - -const _plotly_seriestype = [ - :path, :scatter, :pie, :heatmap, - :contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl, - :straightline -] -const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot] -const _plotly_marker = [ - :none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, - :cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline -] -const _plotly_scale = [:identity, :log10] is_subplot_supported(::PlotlyBackend) = true # is_string_supported(::PlotlyBackend) = true const _plotly_framestyles = [:box, :axes, :zerolines, :grid, :none] diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index 6e06ce71..c77800dc 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -1,12 +1,6 @@ # https://github.com/spencerlyon2/PlotlyJS.jl -const _plotlyjs_attr = _plotly_attr -const _plotlyjs_seriestype = _plotly_seriestype -const _plotlyjs_style = _plotly_style -const _plotlyjs_marker = _plotly_marker -const _plotlyjs_scale = _plotly_scale - # -------------------------------------------------------------------------------------- diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 4933406d..0a581a3f 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1,55 +1,6 @@ # https://github.com/stevengj/PyPlot.jl -const _pyplot_attr = merge_with_base_supported([ - :annotations, - :background_color_legend, :background_color_inside, :background_color_outside, - :foreground_color_grid, :foreground_color_legend, :foreground_color_title, - :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, - :label, - :linecolor, :linestyle, :linewidth, :linealpha, - :markershape, :markercolor, :markersize, :markeralpha, - :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, - :fillrange, :fillcolor, :fillalpha, - :bins, :bar_width, :bar_edges, :bar_position, - :title, :title_location, :titlefont, - :window_title, - :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, - :titlefontfamily, :titlefontsize, :titlefontcolor, - :legendfontfamily, :legendfontsize, :legendfontcolor, - :tickfontfamily, :tickfontsize, :tickfontcolor, - :guidefontfamily, :guidefontsize, :guidefontcolor, - :grid, :gridalpha, :gridstyle, :gridlinewidth, - :legend, :legendtitle, :colorbar, - :marker_z, :line_z, :fill_z, - :levels, - :ribbon, :quiver, :arrow, - :orientation, - :overwrite_figure, - :polar, - :normalize, :weights, - :contours, :aspect_ratio, - :match_dimensions, - :clims, - :inset_subplots, - :dpi, - :colorbar_title, - :stride, - :framestyle, - :tick_direction, - :camera, - :contour_labels, - ]) -const _pyplot_seriestype = [ - :path, :steppre, :steppost, :shape, :straightline, - :scatter, :hexbin, #:histogram2d, :histogram, - # :bar, - :heatmap, :pie, :image, - :contour, :contour3d, :path3d, :scatter3d, :surface, :wireframe - ] -const _pyplot_style = [:auto, :solid, :dash, :dot, :dashdot] -const _pyplot_marker = vcat(_allMarkers, :pixel) -const _pyplot_scale = [:identity, :ln, :log2, :log10] is_marker_supported(::PyPlotBackend, shape::Shape) = true diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl index afdd08cc..370c9a87 100644 --- a/src/backends/unicodeplots.jl +++ b/src/backends/unicodeplots.jl @@ -1,28 +1,6 @@ # https://github.com/Evizero/UnicodePlots.jl -const _unicodeplots_attr = merge_with_base_supported([ - :label, - :legend, - :seriescolor, - :seriesalpha, - :linestyle, - :markershape, - :bins, - :title, - :guide, :lims, - ]) -const _unicodeplots_seriestype = [ - :path, :scatter, :straightline, - # :bar, - :shape, - :histogram2d, - :spy -] -const _unicodeplots_style = [:auto, :solid] -const _unicodeplots_marker = [:none, :auto, :circle] -const _unicodeplots_scale = [:identity] - # don't warn on unsupported... there's just too many warnings!! warnOnUnsupported_args(::UnicodePlotsBackend, plotattributes::KW) = nothing diff --git a/src/examples.jl b/src/examples.jl index e9155d0e..a53707d9 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -437,6 +437,14 @@ each line segment or marker in the plot. ] +# Some constants for PlotDocs and PlotReferenceImages +_animation_examples = [2, 30] +_backend_skips = Dict( + :gr => [25, 30], + :pyplot => [25, 30], + :plotlyjs => [2, 21, 25, 30, 31], +) + # --------------------------------------------------------------------------------- # make and display one plot diff --git a/test/add_packages.jl b/test/add_packages.jl index 1b143c46..954fecb1 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -24,13 +24,13 @@ if isinteractive() PackageSpec(name="VisualRegressionTests"), PackageSpec(name="Gtk"), # PlotlyJS: - # PackageSpec(name="PlotlyJS", rev="master"), - # PackageSpec(name="Blink"), - # PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + PackageSpec(name="PlotlyJS", rev="master"), + PackageSpec(name="Blink"), + PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), # PyPlot: - # PackageSpec(name="PyPlot"), - # PackageSpec(name="PyCall"), - # PackageSpec(name="LaTeXStrings"), + PackageSpec(name="PyPlot"), + PackageSpec(name="PyCall"), + PackageSpec(name="LaTeXStrings"), ]) else push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) diff --git a/test/runtests.jl b/test/runtests.jl index 43ffdac4..62dc73e1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,25 +14,25 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 @test gr() == Plots.GRBackend() @test backend() == Plots.GRBackend() - image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) + # image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end -# @static if isinteractive() -# @testset "PyPlot" begin -# @test pyplot() == Plots.PyPlotBackend() -# @test backend() == Plots.PyPlotBackend() -# -# image_comparison_facts(:pyplot, tol=img_tol, skip = [25, 30]) -# end -# end +@static if isinteractive() + @testset "PyPlot" begin + @test pyplot() == Plots.PyPlotBackend() + @test backend() == Plots.PyPlotBackend() -# @testset "UnicodePlots" begin -# @test unicodeplots() == Plots.UnicodePlotsBackend() -# @test backend() == Plots.UnicodePlotsBackend() -# -# # lets just make sure it runs without error -# @test isa(plot(rand(10)), Plots.Plot) == true -# end + image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) + end +end + +@testset "UnicodePlots" begin + @test unicodeplots() == Plots.UnicodePlotsBackend() + @test backend() == Plots.UnicodePlotsBackend() + + # lets just make sure it runs without error + @test isa(plot(rand(10)), Plots.Plot) == true +end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) From 874dacd2c855562a1ac44653b02f27711130716d Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:04:44 +0200 Subject: [PATCH 11/19] fix plotlyjs (fix #1728) --- src/backends.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 8046d16e..77b6d261 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -579,8 +579,7 @@ end function add_backend_string(::PlotlyJSBackend) """ using Pkg - Pkg.add(["PlotlyJS", "Blink"]) - Pkg.add(PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master")) + Pkg.add(["PlotlyJS", "Blink", "ORCA"]) import Blink Blink.AtomShell.install() """ From cccbaa0bdcea5cf812d7bc4aa60c8c4e08800d6e Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:08:32 +0200 Subject: [PATCH 12/19] skip visual regression tests on windows --- test/runtests.jl | 52 +++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 62dc73e1..f98f877c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -14,18 +14,20 @@ img_tol = isinteractive() ? 1e-2 : 10e-2 @test gr() == Plots.GRBackend() @test backend() == Plots.GRBackend() - # image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) -end - -@static if isinteractive() - @testset "PyPlot" begin - @test pyplot() == Plots.PyPlotBackend() - @test backend() == Plots.PyPlotBackend() - - image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) + @static if Sys.islinux() + image_comparison_facts(:gr, tol=img_tol, skip = [25, 30]) end end +# @static if isinteractive() +# @testset "PyPlot" begin +# @test pyplot() == Plots.PyPlotBackend() +# @test backend() == Plots.PyPlotBackend() +# +# image_comparison_facts(:pyplot, tol=img_tol, skip = [2, 25, 30, 31]) +# end +# end + @testset "UnicodePlots" begin @test unicodeplots() == Plots.UnicodePlotsBackend() @test backend() == Plots.UnicodePlotsBackend() @@ -37,22 +39,22 @@ end # The plotlyjs testimages return a connection error on travis: # connect: connection refused (ECONNREFUSED) -@static if isinteractive() - @testset "PlotlyJS" begin - @test plotlyjs() == Plots.PlotlyJSBackend() - @test backend() == Plots.PlotlyJSBackend() - - image_comparison_facts(:plotlyjs, - skip=[ - 2, # animation (skipped for speed) - 25, - 27, # (polar plots) takes very long / not working - 30, - 31, # animation (skipped for speed) - ], - tol=img_tol) - end -end +# @static if isinteractive() +# @testset "PlotlyJS" begin +# @test plotlyjs() == Plots.PlotlyJSBackend() +# @test backend() == Plots.PlotlyJSBackend() +# +# image_comparison_facts(:plotlyjs, +# skip=[ +# 2, # animation (skipped for speed) +# 25, +# 27, # (polar plots) takes very long / not working +# 30, +# 31, # animation (skipped for speed) +# ], +# tol=img_tol) +# end +# end # InspectDR returns that error on travis: # ERROR: LoadError: InitError: Cannot open display: From 106ed6b953b9f60dbe20f442e55d048b2b3ade30 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:30:42 +0200 Subject: [PATCH 13/19] one more fix for plotlyjs --- src/backends/plotlyjs.jl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl index c77800dc..791016d7 100644 --- a/src/backends/plotlyjs.jl +++ b/src/backends/plotlyjs.jl @@ -6,10 +6,7 @@ function _create_backend_figure(plt::Plot{PlotlyJSBackend}) if !isplotnull() && plt[:overwrite_figure] && isa(current().o, PlotlyJS.SyncPlot) - PlotlyJS.SyncPlot(PlotlyJS.Plot(), - events = current().o.events, - options = current().o.options, - ) + PlotlyJS.SyncPlot(PlotlyJS.Plot(), options = current().o.options) else PlotlyJS.plot() end From b73d7f03a74be2af0b3c3885275ab59cdc310cd3 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Thu, 6 Sep 2018 22:53:32 +0200 Subject: [PATCH 14/19] don't add PyPlot and PlotlyJS in tests --- test/add_packages.jl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/add_packages.jl b/test/add_packages.jl index 954fecb1..4e27bb30 100644 --- a/test/add_packages.jl +++ b/test/add_packages.jl @@ -24,13 +24,13 @@ if isinteractive() PackageSpec(name="VisualRegressionTests"), PackageSpec(name="Gtk"), # PlotlyJS: - PackageSpec(name="PlotlyJS", rev="master"), - PackageSpec(name="Blink"), - PackageSpec(url="https://github.com/sglyon/ORCA.jl.git", rev="master"), + # PackageSpec(name="PlotlyJS"), + # PackageSpec(name="Blink"), + # PackageSpec(name="ORCA"), # PyPlot: - PackageSpec(name="PyPlot"), - PackageSpec(name="PyCall"), - PackageSpec(name="LaTeXStrings"), + # PackageSpec(name="PyPlot"), + # PackageSpec(name="PyCall"), + # PackageSpec(name="LaTeXStrings"), ]) else push!(to_add, PackageSpec(url="https://github.com/JuliaPlots/PlotReferenceImages.jl.git")) From 9c1a5548e1ce2b45417e1894d7fb22b8e222400c Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Tue, 18 Sep 2018 23:50:13 +0200 Subject: [PATCH 15/19] small PGFPlots fix in backends.jl --- src/backends.jl | 67 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 77b6d261..7772b9a3 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -526,39 +526,40 @@ function add_backend_string(::PGFPlotsBackend) """ end -:annotations, -:background_color_legend, -:background_color_inside, -# :background_color_outside, -# :foreground_color_legend, -:foreground_color_grid, :foreground_color_axis, -:foreground_color_text, :foreground_color_border, -:label, -:seriescolor, :seriesalpha, -:linecolor, :linestyle, :linewidth, :linealpha, -:markershape, :markercolor, :markersize, :markeralpha, -:markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, -:fillrange, :fillcolor, :fillalpha, -:bins, -# :bar_width, :bar_edges, -:title, -# :window_title, -:guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, -:tickfont, :guidefont, :legendfont, -:grid, :legend, -:colorbar, :colorbar_title, -:fill_z, :line_z, :marker_z, :levels, -# :ribbon, :quiver, :arrow, -# :orientation, -# :overwrite_figure, -:polar, -# :normalize, :weights, :contours, -:aspect_ratio, -# :match_dimensions, -:tick_direction, -:framestyle, -:camera, -:contour_labels, +const _pgfplots_attr = merge_with_base_supported([ + :annotations, + :background_color_legend, + :background_color_inside, + # :background_color_outside, + # :foreground_color_legend, + :foreground_color_grid, :foreground_color_axis, + :foreground_color_text, :foreground_color_border, + :label, + :seriescolor, :seriesalpha, + :linecolor, :linestyle, :linewidth, :linealpha, + :markershape, :markercolor, :markersize, :markeralpha, + :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle, + :fillrange, :fillcolor, :fillalpha, + :bins, + # :bar_width, :bar_edges, + :title, + # :window_title, + :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, + :tickfont, :guidefont, :legendfont, + :grid, :legend, + :colorbar, :colorbar_title, + :fill_z, :line_z, :marker_z, :levels, + # :ribbon, :quiver, :arrow, + # :orientation, + # :overwrite_figure, + :polar, + # :normalize, :weights, :contours, + :aspect_ratio, + # :match_dimensions, + :tick_direction, + :framestyle, + :camera, + :contour_labels, ]) const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] From d9be97fc450c2753d7c3a01d6c338fc39d3b61e1 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 14 Oct 2018 14:09:43 +0200 Subject: [PATCH 16/19] fix pgfplots saving with FileIO --- src/examples.jl | 1 + src/init.jl | 24 ++++++++++++++++++++++++ src/output.jl | 24 ------------------------ test/imgcomp.jl | 4 ---- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/examples.jl b/src/examples.jl index a53707d9..762d857c 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -443,6 +443,7 @@ _backend_skips = Dict( :gr => [25, 30], :pyplot => [25, 30], :plotlyjs => [2, 21, 25, 30, 31], + :pgfplots => [2, 25, 30], ) # --------------------------------------------------------------------------------- diff --git a/src/init.jl b/src/init.jl index 08d1dd2b..545f55ea 100644 --- a/src/init.jl +++ b/src/init.jl @@ -80,4 +80,28 @@ function __init__() ENV["MPLBACKEND"] = "Agg" end end + + + + # --------------------------------------------------------- + # A backup, if no PNG generation is defined, is to try to make a PDF and use FileIO to convert + @require FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" begin + PDFBackends = Union{PGFPlotsBackend,PlotlyJSBackend,PyPlotBackend,InspectDRBackend,GRBackend} + function _show(io::IO, ::MIME"image/png", plt::Plot{<:PDFBackends}) + fn = tempname() + + # first save a pdf file + pdf(plt, fn) + + # load that pdf into a FileIO Stream + s = FileIO.load(fn * ".pdf") + + # save a png + pngfn = fn * ".png" + FileIO.save(pngfn, s) + + # now write from the file + write(io, read(open(pngfn), String)) + end + end end diff --git a/src/output.jl b/src/output.jl index 1122ab93..df6e3b84 100644 --- a/src/output.jl +++ b/src/output.jl @@ -210,30 +210,6 @@ _show(io::IO, ::MIME{Symbol("text/plain")}, plt::Plot) = show(io, plt) closeall() = closeall(backend()) -# --------------------------------------------------------- -# A backup, if no PNG generation is defined, is to try to make a PDF and use FileIO to convert - -const PDFBackends = Union{PGFPlotsBackend,PlotlyJSBackend,PyPlotBackend,InspectDRBackend,GRBackend} -if is_installed("FileIO") - @eval import FileIO - function _show(io::IO, ::MIME"image/png", plt::Plot{<:PDFBackends}) - fn = tempname() - - # first save a pdf file - pdf(plt, fn) - - # load that pdf into a FileIO Stream - s = FileIO.load(fn * ".pdf") - - # save a png - pngfn = fn * ".png" - FileIO.save(pngfn, s) - - # now write from the file - write(io, read(open(pngfn), String)) - end -end - # function html_output_format(fmt) # if fmt == "png" # @eval function Base.show(io::IO, ::MIME"text/html", plt::Plot) diff --git a/test/imgcomp.jl b/test/imgcomp.jl index 64bfbeb2..526d695e 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -29,11 +29,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) -<<<<<<< HEAD -const _current_plots_version = v"0.20.3" -======= import Plots._current_plots_version ->>>>>>> move _current_plots_version from PlotDocs to Plots function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = isinteractive(), sigma = [1,1], tol = 1e-2) From 22c3afd8a05dac8e821dc38d9e2e4e5b7716437a Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 14 Oct 2018 14:11:16 +0200 Subject: [PATCH 17/19] remove is_installed --- src/utils.jl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index 0db12bc5..22d3df57 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -412,14 +412,6 @@ end isijulia() = :IJulia in nameof.(collect(values(Base.loaded_modules))) isatom() = :Atom in nameof.(collect(values(Base.loaded_modules))) -function is_installed(pkgstr::AbstractString) - try - Pkg.installed(pkgstr) === nothing ? false : true - catch - false - end -end - istuple(::Tuple) = true istuple(::Any) = false isvector(::AVec) = true From 04f502df8aeb8299e3e82dfeeeffa7917f7c0869 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 14 Oct 2018 15:38:50 +0200 Subject: [PATCH 18/19] select pgfplots examples for docs --- src/examples.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples.jl b/src/examples.jl index 762d857c..7050b1e3 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -443,7 +443,7 @@ _backend_skips = Dict( :gr => [25, 30], :pyplot => [25, 30], :plotlyjs => [2, 21, 25, 30, 31], - :pgfplots => [2, 25, 30], + :pgfplots => [2, 5, 6, 10, 16, 20, 22, 23, 25, 28, 30], ) # --------------------------------------------------------------------------------- From 3e1ce8c2fa92fc013c1f6427a9e60860b1890803 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Sun, 14 Oct 2018 15:51:02 +0200 Subject: [PATCH 19/19] really fix conflicts --- src/backends.jl | 20 -------------------- src/examples.jl | 3 --- 2 files changed, 23 deletions(-) diff --git a/src/backends.jl b/src/backends.jl index 57b55549..00ac483a 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -544,11 +544,7 @@ const _pgfplots_attr = merge_with_base_supported([ # :bar_width, :bar_edges, :title, # :window_title, -<<<<<<< HEAD :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, -======= - :guide, :lims, :ticks, :scale, :flip, :rotation, ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b :tickfont, :guidefont, :legendfont, :grid, :legend, :colorbar, :colorbar_title, @@ -564,11 +560,7 @@ const _pgfplots_attr = merge_with_base_supported([ :framestyle, :camera, :contour_labels, -<<<<<<< HEAD ]) -======= - ]) ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b const _pgfplots_seriestype = [:path, :path3d, :scatter, :steppre, :stepmid, :steppost, :histogram2d, :ysticks, :xsticks, :contour, :shape, :straightline,] const _pgfplots_style = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot] const _pgfplots_marker = [:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :pentagon, :hline] #vcat(_allMarkers, Shape) @@ -641,11 +633,7 @@ const _pyplot_attr = merge_with_base_supported([ :bins, :bar_width, :bar_edges, :bar_position, :title, :title_location, :titlefont, :window_title, -<<<<<<< HEAD :guide, :guide_position, :lims, :ticks, :scale, :flip, :rotation, -======= - :guide, :lims, :ticks, :scale, :flip, :rotation, ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b :titlefontfamily, :titlefontsize, :titlefontcolor, :legendfontfamily, :legendfontsize, :legendfontcolor, :tickfontfamily, :tickfontsize, :tickfontcolor, @@ -769,10 +757,7 @@ const _inspectdr_attr = merge_with_base_supported([ :foreground_color_legend, :foreground_color_title, :foreground_color_axis, :foreground_color_border, :foreground_color_guide, :foreground_color_text, :label, -<<<<<<< HEAD :seriescolor, :seriesalpha, -======= ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b :linecolor, :linestyle, :linewidth, :linealpha, :markershape, :markercolor, :markersize, :markeralpha, :markerstrokewidth, :markerstrokecolor, :markerstrokealpha, @@ -786,12 +771,7 @@ const _inspectdr_attr = merge_with_base_supported([ :legendfontfamily, :legendfontsize, :legendfontcolor, :tickfontfamily, :tickfontsize, :tickfontcolor, :guidefontfamily, :guidefontsize, :guidefontcolor, -<<<<<<< HEAD - :grid, #:gridalpha, :gridstyle, :gridlinewidth, #alhpa & linewidth are per plot - not per subplot - :legend, #:legendtitle, :colorbar, -======= :grid, :legend, #:colorbar, ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b # :marker_z, # :line_z, # :levels, diff --git a/src/examples.jl b/src/examples.jl index 6a757453..7050b1e3 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -443,10 +443,7 @@ _backend_skips = Dict( :gr => [25, 30], :pyplot => [25, 30], :plotlyjs => [2, 21, 25, 30, 31], -<<<<<<< HEAD :pgfplots => [2, 5, 6, 10, 16, 20, 22, 23, 25, 28, 30], -======= ->>>>>>> fc51c355a5c1db860ae18146a33f17f784031a4b ) # ---------------------------------------------------------------------------------