has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
3.89k stars 209 forks source link

`geom_pointdensity` doesn't work with facets #808

Closed anishazaveri closed 2 weeks ago

anishazaveri commented 2 weeks ago
import plotnine as p9
import pandas as pd
import numpy as np

x = np.random.normal(size=(5000))
y = np.random.normal(size=(5000))
groups = ["a"]*2500 + ["b"]*2500

df = pd.DataFrame({"x": x, "y": y, "groups": groups})

plt = (p9.ggplot(df, p9.aes(x="x", y="y"))
    + p9.geom_pointdensity()+p9.facet_wrap("~groups"))
plt.show()

I see

PlotnineWarning: geom_pointdensity : Removed 2500 rows containing missing values.

image