python - Seaborn FacetGrid,如何在所有子图中显示 y 刻度标签

标签 python seaborn facet-grid

<分区>

在 Seaborn FacetGrid 中,无论 sharey=True 是否存在,如何让 y 轴刻度标签显示在所有子图中?

tips = sns.load_dataset("tips")
g = sns.FacetGrid(tips, col="time",  row="sex")
g.map(sns.scatterplot, "total_bill", "tip")

enter image description here

以下尝试返回错误 AttributeError: 'FacetGrid' object has no attribute 'flatten'

for axis in g.flatten():
    for tick in axis.get_yticklabels():
        tick.set_visible(True)

最佳答案

for axis in g.axes.flat:
    axis.tick_params(labelleft=True)

这对我有用。

关于python - Seaborn FacetGrid,如何在所有子图中显示 y 刻度标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67390108/

相关文章:

python - 使用 python 将 pandas 数据帧导入 MS Access 表

python - 如何在使用 seaborn 时增加 python 中的绘图大小

python - 如何使用facet创建条形图并使用seaborn添加标签

python - 防止在 relplot 中共享 y 轴

python - 在 Seaborn FacetGrid 图上绘制不同 'hue' 数据的平均线

python - 如何以最快的方式从 Python 中的计数器中删除频率最低的元素?

python - 跳过枚举中的前两个元素——python

python - 在散点图上叠加线函数 - seaborn

python - 使用 Anaconda 在 OS X 上安装 pygraphviz 时出错

python - Seaborn tsplot 错误