Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import seaborn as sns
- import pandas as pd
- def make_lower_pairplot(tmp, plot_unit_line=True, corrs_method = 'spearman'):
- try:
- g = sns.pairplot(tmp)
- except FloatingPointError as e:
- warnings.warn(e.args)
- return tmp
- g.map_upper(lambda x, y, **kwargs: pl.gca().set_visible(False));
- if plot_unit_line:
- g.map_lower(lambda x, y, **kwargs: pl.plot([0,1], [0,1], '--r'))
- for i in range(g.axes.shape[0]):
- g.axes[i, i].set_visible(False)
- g.diag_axes[i].set_visible(False)
- corrs = tmp.corr(method=corrs_method)
- for i in range(g.axes.shape[0]):
- for j in range(i):
- ax = g.axes[i ,j]
- ax.text(0.05, 1, "r = {:.2f}".format(corrs.iloc[i,j]), color='red', transform=ax.transAxes)
Add Comment
Please, Sign In to add comment