Skip to content

Commit

Permalink
add warning on possible mispell of args
Browse files Browse the repository at this point in the history
  • Loading branch information
isentropic committed Jan 4, 2024
1 parent e8a2496 commit 33ac49d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/backends/gr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/backends/pgfplotsx.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/backends/pythonplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

is_marker_supported(::PythonPlotBackend, shape::Shape) = true

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))
Expand Down

0 comments on commit 33ac49d

Please sign in to comment.