diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 43fe66ec..6a7c9df8 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -340,7 +340,7 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o segment_opt = PGFPlotsX.Options() segment_opt = merge(segment_opt, pgfx_linestyle(opt, i)) if opt[:markershape] != :none - marker = opt[:markershape] + marker = _cycle(opt[:markershape], i) if marker isa Shape x = marker.x y = marker.y @@ -417,6 +417,11 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o end pgfx_add_legend!(axis, series, opt, i) end # for segments + # get that last marker + if !any(isnan, opt[:y]) && opt[:markershape] isa AVec + additional_plot = PGFPlotsX.PlotInc(pgfx_marker(opt, length(segments) + 1), PGFPlotsX.Coordinates(tuple((last(opt[:x]), last(opt[:y]))))) + push!(axis, additional_plot) + end end function pgfx_add_series!(::Val{:scatter}, axis, series_opt, series, series_func, opt) @@ -832,9 +837,12 @@ function pgfx_marker(plotattributes, i = 1) pgfx_thickness_scaling(plotattributes) * 0.75 * _cycle(plotattributes[:markersize], i) + mark_freq = !any(isnan, plotattributes[:y]) && plotattributes[:markershape] isa AVec ? + length(plotattributes[:markershape]) : 1 return PGFPlotsX.Options( "mark" => shape isa Shape ? "PlotsShape$i" : pgfx_get_marker(shape), "mark size" => "$mark_size pt", + "mark repeat" => mark_freq, "mark options" => PGFPlotsX.Options( "color" => cstr_stroke, "draw opacity" => a_stroke, diff --git a/test/test_pgfplotsx.jl b/test/test_pgfplotsx.jl index 2e640ead..fdf8ada8 100644 --- a/test/test_pgfplotsx.jl +++ b/test/test_pgfplotsx.jl @@ -326,6 +326,15 @@ end @test ribbon_plot.o !== nothing @test ribbon_plot.o.the_plot !== nothing end # testset + @testset "Markers and Paths" begin + pl = plot(5 .- ones(9), markershape = [:utriangle, :rect], + markersize = 8, + color = [:red, :black]) + Plots._update_plot_object(pl) + axis = Plots.pgfx_axes(pl.o)[1] + plots = filter(x -> x isa PGFPlotsX.Plot, axis.contents) + @test length(plots) == 9 + end # testset end # testset @testset "Extra kwargs" begin