diff --git a/src/pipeline.jl b/src/pipeline.jl index 3ab21814..5fbe7bd5 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -8,24 +8,14 @@ function RecipesPipeline.warn_on_recipe_aliases!( recipe_type::Symbol, @nospecialize(args) ) - for k in keys(plotattributes) - if !is_default_attribute(k) - dk = get(_keyAliases, k, k) - if k !== dk - if recipe_type == :user - signature_string = RecipesPipeline.userrecipe_signature_string(args) - elseif recipe_type == :type - signature_string = RecipesPipeline.typerecipe_signature_string(args) - elseif recipe_type == :plot - signature_string = RecipesPipeline.plotrecipe_signature_string(args) - elseif recipe_type == :series - signature_string = RecipesPipeline.seriesrecipe_signature_string(args) - else - throw(ArgumentError("Invalid recipe type `$recipe_type`")) - end - # @warn "Attribute alias `$k` detected in the $recipe_type recipe defined for the signature $signature_string. To ensure expected behavior it is recommended to use the default attribute `$dk`." + pkeys = keys(plotattributes) + for k in pkeys + dk = get(_keyAliases, k, nothing) + if dk !== nothing + kv = RecipesPipeline.pop_kw!(plotattributes, k) + if dk ∉ pkeys + plotattributes[dk] = kv end - plotattributes[dk] = RecipesPipeline.pop_kw!(plotattributes, k) end end end diff --git a/test/test_recipes.jl b/test/test_recipes.jl index 418e4465..88d644cd 100644 --- a/test/test_recipes.jl +++ b/test/test_recipes.jl @@ -1,6 +1,18 @@ using Plots, Test using OffsetArrays +@testset "User recipes" begin + struct LegendPlot end + @recipe function f(plot::LegendPlot) + legend --> :topleft + (1:3, 1:3) + end + pl = plot(LegendPlot(); legend = :right) + @test pl[1][:legend_position] == :right + pl = plot(LegendPlot()) + @test pl[1][:legend_position] == :topleft +end + @testset "lens!" begin pl = plot(1:5) lens!(pl, [1, 2], [1, 2], inset = (1, bbox(0.0, 0.0, 0.2, 0.2)), colorbar = false)