Seaborn PairGrid: 显示每个子图的坐标轴刻度标签。

5

使用 seaborn.PairGrid,是否有一种方法可以在每个子图中显示坐标轴刻度标签?(类似于seaborn.FacetGridsharex = False,sharey = False的功能)

import pandas as pd
import numpy as np    
import seaborn as sns
import matplotlib.pyplot as plt

df = pd.DataFrame()
for n in ['a', 'b']:
    tmp = pd.DataFrame({'name': [n] * 100,
                        'prior': [1, 10] * 50,
                        'post': [1, 10] * 50})
    df = df.append(tmp)

g = sns.PairGrid(df, hue='name', diag_sharey=False)
g.map_offdiag(sns.regplot, fit_reg=False, x_jitter=.1)
g.map_diag(sns.distplot, kde=False)
3个回答

4

1
在PairGrid中出现此错误:AttributeError: 'NoneType' object has no attribute 'get_yticklabels' 有什么建议或者我晚了5年:D? - rahul-ahuja

0

我编辑了我的问题以澄清:我指的是坐标轴刻度标签。它们仅显示在主绘图坐标轴上。我希望它们出现在每个子图上。 - Antoine Gautier

0

我会在pairplot的PairGrid上调用.set

g = sns.pairplot(...)
g.set(xticklabels=[], yticklabels=[])

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接