pythonseabornseaborn-objects

How to add an arbitrary line to Seaborn.Objects plot


Is there a way using seaborn objects to add arbitrary line into a plot? Something like ggplots geom_abline specifying slope and intercept? I mean, using seaborn objects API only. ...

# this DOES NOT WORK
(
   so.Plot(df, x="var1",y="var2")
        .add(so.Dot())
        .add(so.Line(color="black"), slope=1, intercept=1) 
)

Solution

  • Newermind, I've solved this one. There is no that simple solution in Seaborn 0.12. You need to go into matplotlib.

    So, I've implemented the Mark for you - so.Axline(). And I've added two more so.Axvline() and so.Axhline(). To enrich the functionality, there are some more changes (adding so.AggCustom() etc.).

    It has not been merged yet. See the PR link for reference. The code implementing those objects is to be found therein.