Compare commits

...

1 Commits

Author SHA1 Message Date
Simon Christ
4c8502861e fix segments 2020-09-15 17:30:32 +02:00
2 changed files with 18 additions and 1 deletions

View File

@ -340,7 +340,7 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o
segment_opt = PGFPlotsX.Options() segment_opt = PGFPlotsX.Options()
segment_opt = merge(segment_opt, pgfx_linestyle(opt, i)) segment_opt = merge(segment_opt, pgfx_linestyle(opt, i))
if opt[:markershape] != :none if opt[:markershape] != :none
marker = opt[:markershape] marker = _cycle(opt[:markershape], i)
if marker isa Shape if marker isa Shape
x = marker.x x = marker.x
y = marker.y y = marker.y
@ -417,6 +417,11 @@ function pgfx_add_series!(::Val{:path}, axis, series_opt, series, series_func, o
end end
pgfx_add_legend!(axis, series, opt, i) pgfx_add_legend!(axis, series, opt, i)
end # for segments 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 end
function pgfx_add_series!(::Val{:scatter}, axis, series_opt, series, series_func, opt) 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) * pgfx_thickness_scaling(plotattributes) *
0.75 * 0.75 *
_cycle(plotattributes[:markersize], i) _cycle(plotattributes[:markersize], i)
mark_freq = !any(isnan, plotattributes[:y]) && plotattributes[:markershape] isa AVec ?
length(plotattributes[:markershape]) : 1
return PGFPlotsX.Options( return PGFPlotsX.Options(
"mark" => shape isa Shape ? "PlotsShape$i" : pgfx_get_marker(shape), "mark" => shape isa Shape ? "PlotsShape$i" : pgfx_get_marker(shape),
"mark size" => "$mark_size pt", "mark size" => "$mark_size pt",
"mark repeat" => mark_freq,
"mark options" => PGFPlotsX.Options( "mark options" => PGFPlotsX.Options(
"color" => cstr_stroke, "color" => cstr_stroke,
"draw opacity" => a_stroke, "draw opacity" => a_stroke,

View File

@ -326,6 +326,15 @@ end
@test ribbon_plot.o !== nothing @test ribbon_plot.o !== nothing
@test ribbon_plot.o.the_plot !== nothing @test ribbon_plot.o.the_plot !== nothing
end # testset 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 end # testset
@testset "Extra kwargs" begin @testset "Extra kwargs" begin