Seaborn PairGrid – how to add frames? (top and right spines)

Question:

I’m trying to change the style of sns PairGrid graph. Namely, I want to add a frame around each of the grid graphs. What one graph looks like right now:

the graph now

How I want it to look:

the graph with the frame

I’ve already spent a ton of time reading the documentation and searching the Internet, but I haven’t found any suitable answer. Is it even possible with PairGrid?

Thank you all for your help.

Asked By: swayn

||

Answers:

Use the despine=False option of PairGrid:

import seaborn as sns

penguins = sns.load_dataset("penguins")
g = sns.PairGrid(penguins, despine=False)
g.map(sns.scatterplot)

Example:

enter image description here

Answered By: mozway
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.