diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index f88a65aa..24fd7822 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -403,6 +403,9 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o ), ), ) + if opt[:label] == "" + push!(arrow_opt, "forget plot" => nothing) + end if arrow.side == :head x_arrow = opt[:x][rng][(end - 1):end] y_arrow = opt[:y][rng][(end - 1):end] @@ -426,6 +429,7 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o :v => [y_arrow[i] - y_arrow[i - 1] for i in 2:2:lastindex(y_arrow)], ]) arrow_plot = series_func(merge(series_opt, arrow_opt), coordinates) + push!(series_opt, "forget plot" => nothing) push!(axis, arrow_plot) coordinates = PGFPlotsX.Table(x_path, y_path) segment_plot = series_func(merge(series_opt, segment_opt), coordinates) diff --git a/test/runtests.jl b/test/runtests.jl index 71de7769..2613f901 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -363,7 +363,10 @@ Random.seed!(PLOTS_SEED) default(show = false, reuse = true) # don't actually show the plots is_ci() = get(ENV, "CI", "false") == "true" -const PLOTS_IMG_TOL = parse(Float64, get(ENV, "PLOTS_IMG_TOL", is_ci() ? "1e-4" : "1e-5")) +const PLOTS_IMG_TOL = parse( + Float64, + get(ENV, "PLOTS_IMG_TOL", is_ci() ? Sys.iswindows() ? "2e-4" : "1e-4" : "1e-5"), +) ## Uncomment the following lines to update reference images for different backends diff --git a/test/test_pgfplotsx.jl b/test/test_pgfplotsx.jl index 21144db4..f3d91185 100644 --- a/test/test_pgfplotsx.jl +++ b/test/test_pgfplotsx.jl @@ -21,16 +21,19 @@ end @test !haskey(axis.contents[1].options.dict, "fill") @testset "Legends" begin - legends_plot = plot(rand(5, 2), lab = ["1" ""]) + legends_plot = plot(rand(5, 2), lab = ["1" ""], arrow = true) scatter!(legends_plot, rand(5)) Plots._update_plot_object(legends_plot) axis_contents = Plots.pgfx_axes(legends_plot.o)[1].contents leg_entries = filter(x -> x isa PGFPlotsX.LegendEntry, axis_contents) series = filter(x -> x isa PGFPlotsX.Plot, axis_contents) @test length(leg_entries) == 2 + @test length(series) == 5 @test !haskey(series[1].options.dict, "forget plot") @test haskey(series[2].options.dict, "forget plot") - @test !haskey(series[3].options.dict, "forget plot") + @test haskey(series[3].options.dict, "forget plot") + @test haskey(series[4].options.dict, "forget plot") + @test !haskey(series[5].options.dict, "forget plot") end # testset @testset "3D docs example" begin