简体   繁体   English

条形或标签之间的间距

[英]Spacing between bars or labels

so I'm trying to set the spacing between x labels or somehow make spaces between every bar in every subplot in the chart so that they wouln't overlap eachother even a little bit. 因此,我试图设置x标签之间的间距,或者以某种方式在图表的每个子图中的每个条形图之间留出间隔,以使它们不会彼此重叠。 I've tried rotating but some of the x labels are still overlapping and it doesn't look right. 我试过旋转,但是某些x标签仍然重叠并且看起来不正确。 How can I make it more visually appealing? 如何使它更具视觉吸引力?

g=sns.factorplot(x='type1', col='type2',col_wrap=3, data=dframe, kind='count', sharex=False, sharey=False, palette=pokemon_color_palette)

for ax in g.axes.flat:
    for label in ax.get_xticklabels():
        label.set_rotation(60)


for ax in g.axes.flat:
    ax.set_xlabel('type1', color='indianred')

plt.tight_layout()

图表示例

为什么不缩小刻度标签的大小。

ax.tick_params(axis='x', labelsize=10)

Why do not you turn the labels 90°? 为什么不将标签旋转90°? That way they will never overlap. 这样,它们将永远不会重叠。

    label.set_rotation(60)

Result: 结果:

在此处输入图片说明

Also you could not show the xlabel when there is no pokemon with those types. 同样,当没有这些类型的口袋妖怪时,您将无法显示xlabel。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM