Reputation: 970
I am plotting using seaborn
and I am using seaborn.PairGrid
function. This is creating 6 x 6 grid, where diagonal plots are histograms and off diagonal plots are scatter plots. Now I want to have different y ranges for each row of plots and different x ranges for each column of the plots. I searched stack exchange a lot but could not find a way to achieve this. Matplot version is 2.0.0
and seaborn
version is 0.7.1
.
Thanks
Upvotes: 9
Views: 5343
Reputation: 339560
You can use the Axes.set_xlim()
and Axes.set_ylim()
methods on the axes of the seaborn PairGrid
or FacetGrid
. The axes are available from the PairGrid
as .axes
attribute.
import matplotlib.pyplot as plt import seaborn as sns iris = sns.load_dataset("iris") g = sns.PairGrid(iris) g = g.map_diag(plt.hist, edgecolor="k") g = g.map_offdiag(plt.scatter, s=10) g.axes[2,0].set_ylim(-10,10) g.axes[0,1].set_xlim(-40,10) plt.show()
Upvotes: 10