I'm establishing a FacetGrid based on ‘cut’ and ‘color’ using the built-in Seaborn dataset diamonds. However, I'm first removing colors ‘D’ and ‘E’ as well as the cut ‘Fair’, to hopefully result in a 5x5 grid.
The code I have is:
diamonds = sns.load_dataset("diamonds")
diamonds = diamonds[(~diamonds.color.isin(["D","E"])) & (diamonds.cut!="Fair")]
p2 = sns.FacetGrid(diamonds,row="cut",col="color")
p2 = p2.map(plt.scatter,"price","carat")
When I run this in Jupyter notebook, I get two columns for "D" and "E" and one row for "Fair" still on the grid, but all the facets associated with these two columns and one row are empty. See image
My question is, how do I remove these empty facets? I don't understand how the FacetGrid is even aware these levels still exist, as I removed them before calling the FacetGrid() method.
Thanks!