Skip to content

PairGrid subplot axis label not showing #3092

Description

@luzclasil

I want to get the same xlabel and ylabel in all subplots, not just in the outer ones.
Over the past few days I tried to follow several posts all over stack overflow without success. I believe something might have changed over the years due to updates so this is why the code I'm getting no longer works. It's either this or I'm doing something very wrong.
I've already reported the issue here, so any type of help is welcome.
I must apologize in advance because I'm not very experienced with Seaborn/Matplotlib, so I'm inclined to say there might be something wrong with my code and not an actual bug with the package.
Thank you.

import seaborn as sns
import matplotlib.pyplot as plt

iris = sns.load_dataset("iris")

h = sns.PairGrid(iris, despine=False, diag_sharey=False)
g = h.map(plt.scatter)

for ax in g.axes.flat:
    ax.tick_params(axis='both', labelleft=True, labelbottom=True)
    ax.set(xlabel='X label', ylabel ='Y label') #only the left/bottom ones are affected. The middle subplots remain with no label.

plt.subplots_adjust(wspace=0.7, hspace=0.3)

plt.show()

Versions I'm running: Python: 3.10.1; Seaborn: 0.12.0; Matplotlib: 3.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions