Skip to content

Conversation

isentropic
Copy link
Member

Description

Consider a case from https://docs.juliaplots.org/stable/backends/#Fine-tuning

x = range(-3, 3, length=30)
surface(
  x, x, (x, y)->exp(-x^2 - y^2), c=:viridis, legend=:none,
  nx=50, ny=50, display_option=Plots.GR.OPTION_SHADED_MESH,  # <-- series[:extra_kwargs]
)

Upon mispelling of any kws it is interpretted as an extra_kw which leads to silent ignoring of kws:

# before
plot(rand(10), newweirdarg=true)

just plots.
Now it outputs:

 Warning: Extra keyword argument newweirdarg not explicitly supported with Plots.GRBackend().  Choose from: legend_hfactor, legend_wfactor, nx, ny, display_option
└ @ Plots ~/Projects/Plots.jl/src/args.jl:1564

Granted this is a crutch as I just look over a list of predefined kws, but in principle this mechanism could be more sophisiticated per backend. What you think?

@BeastyBlacksmith
Copy link
Member

In principle I am on board with the idea, but e.g. the PGFPlotsX backend makes deliberate use of this as in it passes all extra keywords to the backend and they usually just work.
See #2200 for reference. So to get it right, we would need to check against every valid keyword of pgfplots (and keep it up to date).

@isentropic
Copy link
Member Author

isentropic commented May 27, 2024

We could just ignore this check for PGF plots, it could just support all of them. I understand that you might wanna add more tex there.
But other backends aren't as much flexible

@BeastyBlacksmith
Copy link
Member

Yeah, if we make the check use a predicate function, that could just return true in that case

Copy link

codecov bot commented May 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.58%. Comparing base (fa65e7d) to head (8bf9d59).
Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4861      +/-   ##
==========================================
- Coverage   89.77%   89.58%   -0.19%     
==========================================
  Files          40       40              
  Lines        8780     8787       +7     
==========================================
- Hits         7882     7872      -10     
- Misses        898      915      +17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants