Attribute Error seaborn pairplot ticklabel rotation
I'm trying to generate a seaborn pairplot with the ticklabels roatated. My code is here:
sns.set(font_scale = 3,style=whitegrid)
h = sns.pairplot(data=dfMViral, hue = 'ID',palette = ['#0000ff','#00ff00','#ff0000'],corner=True,diag_kind=hist)
h._legend.remove()
for axes in h.axes.flat:
axes.set_xlabel(axes.get_xlabel(), rotation=45)
plt.show()
This is based on the answer here: https://stackoverflow.com/questions/61936040/rotate-ylabel-in-seaborn-pairplot
But when I try this I get the following error:
AttributeError Traceback (most recent call last)
ipython-input-47-3f18bb9ee92a in module
7
8 for axes in h.axes.flat:
---- 9 axes.set_xlabel(axes.get_xlabel(), rotation=45)
10
11 plt.show()
AttributeError: 'NoneType' object has no attribute 'set_xlabel'
I have tried several searches for alternatives and the error, but they all say to do what I have done above.
I was wondering if anyone might have some suggestions to resolve this
Topic python-3.x seaborn
Category Data Science