From 3c14c7d1308419be23d0e6ab19a1d0904ff36dcb Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Fri, 10 Feb 2023 09:19:06 +0100 Subject: [PATCH] give markershape precedence over marker (#4651) * give markershape precedence over marker * Update test/test_args.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/args.jl | 2 +- test/test_args.jl | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/args.jl b/src/args.jl index 09b378d01..a0b3a9854 100644 --- a/src/args.jl +++ b/src/args.jl @@ -1106,7 +1106,7 @@ end function processMarkerArg(plotattributes::AKW, arg) # markershape - if allShapes(arg) + if allShapes(arg) && !haskey(plotattributes, :markershape) plotattributes[:markershape] = arg # stroke style diff --git a/test/test_args.jl b/test/test_args.jl index 816585360..4001d8289 100644 --- a/test/test_args.jl +++ b/test/test_args.jl @@ -1,3 +1,30 @@ +struct Foo{T} + x::Vector{T} + y::Vector{T} +end + +@recipe function f(foo::Foo) + xlabel --> "x" + ylabel --> "y" + seriestype --> :path + marker --> :auto + return foo.x, foo.y +end + +x = collect(0.0:10.0) +foo = Foo(x, sin.(x)) + +@testset "Magic attributes" begin + @test plot(foo)[1][1][:markershape] === :+ + @test plot(foo, markershape = :diamond)[1][1][:markershape] === :diamond + @test plot(foo, marker = :diamond)[1][1][:markershape] === :diamond + @test (@test_logs (:warn, "Skipped marker arg diamond.") plot( + foo, + marker = :diamond, + markershape = :diamond, + )[1][1][:markershape]) === :diamond +end + @testset "Subplot Attributes" begin let pl = plot(rand(4, 4), layout = 2) @test pl[1].primary_series_count == 2