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: