使用 seaborn 包关闭 jointplot 上的边际分布轴
Turn off marginal distribution axes on jointplot using seaborn package
我喜欢这个特别的情节以及将函数传递给 stat_func 关键字以快速绘制和可视化变量之间关系的能力,但有一件事。如何 'turn off' 或不绘制边缘分布轴?
它看起来不错,但有时我不想要这个功能。
例如使用此代码:
import numpy as np
import seaborn as sns
x = np.arange(100) + np.random.randn(100)*20
y = np.arange(100) + np.random.randn(100)*20
sns.jointplot(x, y, kind='reg')
如何删除主轴顶部和右侧的 kde 子图?
您可以直接使用JointGrid
:
from scipy import stats
g = sns.JointGrid(x, y, ratio=100)
g.plot_joint(sns.regplot)
g.annotate(stats.pearsonr)
g.ax_marg_x.set_axis_off()
g.ax_marg_y.set_axis_off()
我喜欢这个特别的情节以及将函数传递给 stat_func 关键字以快速绘制和可视化变量之间关系的能力,但有一件事。如何 'turn off' 或不绘制边缘分布轴?
它看起来不错,但有时我不想要这个功能。
例如使用此代码:
import numpy as np
import seaborn as sns
x = np.arange(100) + np.random.randn(100)*20
y = np.arange(100) + np.random.randn(100)*20
sns.jointplot(x, y, kind='reg')
如何删除主轴顶部和右侧的 kde 子图?
您可以直接使用JointGrid
:
from scipy import stats
g = sns.JointGrid(x, y, ratio=100)
g.plot_joint(sns.regplot)
g.annotate(stats.pearsonr)
g.ax_marg_x.set_axis_off()
g.ax_marg_y.set_axis_off()