PairGrid
PairGrid is a subplot grid for plotting pairwise relationships in a dataset.
This object maps each variable in a dataset onto a column and row in a grid of multiple axes. Different axes-level plotting functions can be used to draw bivariate plots in the upper and lower triangles, and then the marginal distribution of each variable can be shown on the diagonal.






import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
df = pd.read_csv('filename.csv')
# Creating the PairGrid variable
g = sns.PairGrid(df)
# Setting diagonale plots
g.map_diag(sns.histplot)
# Setting non-diagonal plots
g.map_offdiag(sns.scatterplot)
plt.show()
Swipe to start coding
- Set the
'ticks'style with the'lightpink'figure.facecolor. - Create a
PairGridvariable usingg:
- Set the data for the
g; - Set the
hueparameter equals the'species'; - Set the
'rocket_r'palette.
Set diagonale plots using the .map_diag() function:
- Create a
histplotusing theseaborn; - Add the
kdeparameter.
Set non-diagonale plots using the .map_offdiag() function:
- Create a
scatterplotusing theseaborn; - Set the
linewidthparameter equals0.9; - Set the
'purple'edgecolorparameter.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Resumir este capítulo
Explicar el código en file
Explicar por qué file no resuelve la tarea
Awesome!
Completion rate improved to 4.35
PairGrid
Desliza para mostrar el menú
PairGrid is a subplot grid for plotting pairwise relationships in a dataset.
This object maps each variable in a dataset onto a column and row in a grid of multiple axes. Different axes-level plotting functions can be used to draw bivariate plots in the upper and lower triangles, and then the marginal distribution of each variable can be shown on the diagonal.






import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
df = pd.read_csv('filename.csv')
# Creating the PairGrid variable
g = sns.PairGrid(df)
# Setting diagonale plots
g.map_diag(sns.histplot)
# Setting non-diagonal plots
g.map_offdiag(sns.scatterplot)
plt.show()
Swipe to start coding
- Set the
'ticks'style with the'lightpink'figure.facecolor. - Create a
PairGridvariable usingg:
- Set the data for the
g; - Set the
hueparameter equals the'species'; - Set the
'rocket_r'palette.
Set diagonale plots using the .map_diag() function:
- Create a
histplotusing theseaborn; - Add the
kdeparameter.
Set non-diagonale plots using the .map_offdiag() function:
- Create a
scatterplotusing theseaborn; - Set the
linewidthparameter equals0.9; - Set the
'purple'edgecolorparameter.
Solución
¡Gracias por tus comentarios!
single