Ofosu-Osei / seaborn_objects_recipes

seaborn_objects_recipes is a Python package that extends the functionality of the Seaborn library, providing custom recipes for enhanced data visualization. This package includes below features to augment your Seaborn plots with additional capabilities.
MIT License
8 stars 1 forks source link

The goal (syntactically) #9

Closed nickeubank closed 2 months ago

nickeubank commented 4 months ago

So this code is basically perfect:

np.random.seed(0)
x = np.linspace(0, 2 * np.pi, 100)
y = np.sin(x) + np.random.normal(size=100) * 0.2
data = pd.DataFrame({"x": x, "y": y})

(
    so.Plot(
        data,
        x="x",
        y="y",
    )
    .add(so.Dot())
    .add(so.Lines(), sor.Lowess())
    .label(x="x-axis", y="y-axis", title="Lowess Plot Example")
    .save("lowess.png")

This is breaking:

image

Because you've created an object of sor.Lowess() instead of making an so.Plot() object whose .add() method you can use.