diff --git a/src/args.jl b/src/args.jl index 94c44f10b..9fdda0694 100644 --- a/src/args.jl +++ b/src/args.jl @@ -1558,6 +1558,12 @@ function warn_on_unsupported_args(pkg::AbstractBackend, plotattributes) end end end + supported_extra_kws = extra_supported_kws(pkg) + for kw in keys(extra_kwargs) + if kw ∉ supported_extra_kws + @warn "Extra keyword argument $kw not explicitly supported with $pkg. Choose from: $(join(supported_extra_kws, ", "))" + end + end extra_kwargs end diff --git a/src/backends.jl b/src/backends.jl index 1a75a940a..47560f40c 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -301,6 +301,7 @@ const _base_supported_args = [ :permute, :unitformat, ] +extra_supported_kws(pkg::AbstractBackend) = [] function merge_with_base_supported(v::AVec) v = vcat(v, _base_supported_args) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 896e978fb..e41d8f442 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -104,6 +104,8 @@ const gr_font_family = Dict( "computer modern" => 232, "dejavu sans" => 233, ) +extra_supported_kws(::GRBackend) = + [:legend_hfactor, :legend_wfactor, :nx, :ny, :display_option] mutable struct GRViewport{T} xmin::T diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index 8913f8738..19fa4c99e 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -1,6 +1,7 @@ const Options = PGFPlotsX.Options const Table = PGFPlotsX.Table +extra_supported_kws(::PGFPlotsXBackend) = [:add] Base.@kwdef mutable struct PGFPlotsXPlot is_created::Bool = false was_shown::Bool = false diff --git a/src/backends/pythonplot.jl b/src/backends/pythonplot.jl index 38ef52574..07737cb50 100644 --- a/src/backends/pythonplot.jl +++ b/src/backends/pythonplot.jl @@ -2,6 +2,10 @@ is_marker_supported(::PythonPlotBackend, shape::Shape) = true +# As this gets longer perhaps it should be a Set +extra_supported_kws(::PythonPlotBackend) = + [:levels, :mincnt, :edgecolors, :extend3d, :colors, :cmap, :facecolors, :shade] + # problem: github.com/tbreloff/Plots.jl/issues/308 # solution: hack from @stevengj: github.com/JuliaPy/PyPlot.jl/pull/223#issuecomment-229747768 let otherdisplays = splice!(Base.Multimedia.displays, 2:length(Base.Multimedia.displays))