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
In Seaborn, we will plot multiple graphs in a single window in two ways. First with the help of Facetgrid() function and other by implicit with the help of matplotlib. data: Tidy dataframe where each column is a variable and each row is an observation.
PairGrid allows us to draw a grid of subplots using the same plot type to visualize data. Unlike FacetGrid, it uses different pair of variable for each subplot. It forms a matrix of sub-plots. It is also sometimes called as “scatterplot matrix”. The usage of pairgrid is similar to facetgrid.
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With