Skip to content

Commit

Permalink
give markershape precedence over marker (#4651)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
BeastyBlacksmith and github-actions[bot] authored Feb 10, 2023
1 parent 870c0f2 commit 3c14c7d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions test/test_args.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3c14c7d

Please sign in to comment.