seaborn.objects: Add ability to specify which vars to aggregate #3426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is more the sketch of an idea to gauge interest/get feedback (albeit a functional one). I've wanted to be able to label the value of aggregated data points. However, currently
Agg
only targetsx
ory
. Specifyingtext
to a continuous variable thus immediately breaks up aggregation groups. The idea with this PR is to allow the specification of which variables you're targeting for aggregation. For example:which results in:
The biggest downside to this approach is it applies the same aggregation to all variables. Other approaches considered:
func
to be adict
from variable names to functions, which solves the above downside.Dodge
, though it doesn't solve the problem of using different aggregations on different variables.Other downsides include having to re-specify the same aggregation for all marks, but that's easily solved by the user (just assign the agg to a variable).
I'd also like to add similar functionality to other transforms in the stats package, like
so.Est
andso.PolyFit
. The primary application would again be for labeling the values of those things, but I could also imagine it being useful for other things.As an aside, I cannot believe how easy this was to implement! What a lovely codebase to work with.