2024-10-02 22:30:01 发布
网友
我有一个使用seaborn包生成的散点图矩阵,我想删除所有的勾号标签,因为这些只是把图形弄乱了(要么是这个,要么只是删除x轴上的那些),但我不确定如何做,而且在谷歌搜索中没有成功。有什么建议吗?
seaborn
import seaborn as sns sns.pairplot(wheat[['area_planted', 'area_harvested', 'production', 'yield']]) plt.show()
import seaborn as sns iris = sns.load_dataset("iris") g = sns.pairplot(iris) g.set(xticklabels=[])
您可以使用列表理解循环遍历所有列并关闭xaxis的可见性。
df = pd.DataFrame(np.random.randn(1000, 2)) * 1e6 sns.pairplot(df)
plot = sns.pairplot(df) [plot.axes[len(df.columns) - 1][col].xaxis.set_visible(False) for col in range(len(df.columns))] plt.show()
您还可以将数据重新缩放为更可读的内容:
df /= 1e6 sns.pairplot(df)
您可以使用列表理解循环遍历所有列并关闭xaxis的可见性。
您还可以将数据重新缩放为更可读的内容:
相关问题 更多 >
编程相关推荐