-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Is there a plan to add internal axvline/axhline support to seaborn.objects soon? #3693
Comments
I don't think there is anything planned in a near future for this. I have my own code to do this if you like, as thankfully the objects API is modular :
I only use this when I want to plot an aggregate value though (e.g. mean or median), otherwise I use the |
Thank you, good to know! As for laboriousness, it's mostly just on a pedagogical level rather than a typing-lines level. If there were an so.axhline method, I could do it in the same way I do the rest of the graph. Since there's not, I need to introduce the whole fig thing and .on(fig) as concepts, which are different ways of approaching the graph-making. |
The question is : what exactly is it supposed to do ? The seaborn objects operate on the DataFrame; there is no reason to have one that plots an arbitrary value, and it is pretty weird semantically. This is why I only use my custom object when plotting aggregate value, which makes sense as seaborn can compute those using |
That's interesting - given the so.Plot().add() structure, I have thought of the conceptual framing of .add() being that we are operating on the plot itself, rather than the data frame. In that context it would make intuitive sense that you could put things into .add() that are not reliant on the data itself. |
The tricky thing as I recall it is that sometimes you would want a horizontal or vertical rules to be dependent on the data, eg you might want to show a distribution and then draw a vertical line at its mean, and then do that when grouping by a color variable, etc. I do also think that using matplotlib objects directly is an anti-pattern (currently necessary here, but the sign of a feature gap). |
Yes, definitely, I think reference lines based on statistics like means (and potentially within groupings) and based on constants that are given meaning by the data but not necessarily calculated based on the data are both very common. In my experience using This is just an offhand thought but I wonder if a syntax-compatible way of doing this would be to treat the use of constants like this as a kind of aggregation/Stat. Like if I could do |
To be clear I don't think there are any conceptual problems with |
Also, interaction with things like |
I am currently in the process of updating my book for its second edition, and am changing the Python plotting code I suggest to readers to use
seaborn.objects
where possible.However, the plotting code I use in the book contains quite a few
plt.axvline()
andplt.axhline()
lines! I am now changing these to the fairly laboriousfig = plt.figure(); (so.Plot().on(fig).etc.); fig.axes[0].axhline()
.I know there have been several issues previously about adding
axhline/axvline
support, and I know you've expressed interest in supporting it and that there are barriers to doing so. My main question is whether there's a plan to implement this on the horizon soon, i.e. I should be planning to revise my book text to reflect the new implementation before I publish the thing. If there's not, that's fine, I'm still planning to make theseaborn.objects
switch. But this thing will be in print for quite a while and I'd rather it not get out of date that fast.Thank you!
The text was updated successfully, but these errors were encountered: