Reputation: 339
I have a pairplot in Python. I like to add x-axis and y-axis ticks (i.e, numbers) to all boxes. So, the ticks and their labels at the bottom and left side of pairplot will repeat for each box. See the below pictures.
Thanks in advance!
What I have
what I want to have
Upvotes: 1
Views: 1526
Reputation: 35205
You can set ax.tick_params()
and adjust the subplot spacing.
import matplotlib.pyplot as plt
import seaborn as sns
penguins = sns.load_dataset("penguins")
pp = sns.pairplot(
penguins,
x_vars=["bill_length_mm", "bill_depth_mm", "flipper_length_mm"],
y_vars=["bill_length_mm", "bill_depth_mm"],
)
for ax in pp.axes.flat:
ax.tick_params(axis='both', labelleft=True, labelbottom=True)
plt.subplots_adjust(wspace=0.3, hspace=0.3)
plt.show()
Upvotes: 4