-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply recipes to keyword arguments #4453
base: master
Are you sure you want to change the base?
Conversation
src/axes.jl
Outdated
@@ -81,6 +81,7 @@ end | |||
function attr!(axis::Axis, args...; kw...) | |||
# first process args | |||
plotattributes = axis.plotattributes | |||
dummy_attributes = Dict{Symbol, Any}(:plot_object=>first(axis.sps).plt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are those needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. RecipesPipeline._apply_type_recipe
has
Plots.jl/RecipesPipeline/src/type_recipe.jl
Lines 18 to 25 in 399ee6a
function _apply_type_recipe(plotattributes, v, letter) | |
plt = plotattributes[:plot_object] | |
preprocess_axis_args!(plt, plotattributes, letter) | |
rdvec = RecipesBase.apply_recipe(plotattributes, typeof(v), v) | |
warn_on_recipe_aliases!(plotattributes[:plot_object], plotattributes, :type, v) | |
postprocess_axis_args!(plt, plotattributes, letter) | |
return rdvec[1].args[1] | |
end |
where it asks the first argument for
:plot_object
, which it then uses for pre- and postprocessing. Perhaps the function should instead be extended to accept an Axis
object instead or something, this just seemed like the minimum intrusion operation to me.
Codecov ReportBase: 80.60% // Head: 79.88% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4453 +/- ##
==========================================
- Coverage 80.60% 79.88% -0.73%
==========================================
Files 30 40 +10
Lines 7466 8196 +730
==========================================
+ Hits 6018 6547 +529
- Misses 1448 1649 +201
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
7ba2d7f
to
2c90439
Compare
There are some keyword arguments which it makes sense to interpret as "on a data axis" - meaning that it would be useful to query the recipe pipeline for how to interpret user provided types.
Some such arguments that I have identified are
marker_z
and friendsmarker_size
(this one is questionable)So far, a number of these have been hardcoded for
Unitful
andDates
, which are two of the most obvious use cases, but if a user wanted to be able to set limits in their own data type they would have to either override unexported Plots functions or handle the conversion toTuple{Float, Float}
themselves. With this PR, a type recipe is enough.