小编pol*_*nda的帖子

如何将 adjustment_text 与plotnine 一起使用?

我正在尝试调整 geom_text 标签,使它们不重叠。使用 nudge_x、nudge_y 和 size 调整标签并没有给我一个非常满意的结果。我遇到了 adjustment_text 包,但我无法将其实现到我的代码中。

现在我的图表看起来像这样:

图形

我尝试添加 adjustment_text =True (见下文),这给了我以下错误。“几何、统计或图层都无法理解参数{'调整文本'}。”

(ggplot(nutrient_rel_item, aes(y='Share_calories', x='Share_biomass', color='Type',show_legend=False))
+stat_smooth( aes(y='Share_calories', x='Share_biomass'),method='lm',inherit_aes=False) 
+geom_text(aes(label='Abb'),data=nutrient_rel_item, nudge_x=0.1, nudge_y=0.1, size=4, adjust_text =True)
+facet_wrap('~CCC1',nrow=2)
+ scale_x_log10(labels=lambda l: ["%d%%" % (v * 100) for v in l])
+ scale_y_log10(labels=lambda l: ["%d%%" % (v * 100) for v in l])
+ geom_point(size=0.1) 
+ geom_path(aes(group='Item'), arrow= arrow(angle = 15, length= 0.1, type = "closed"))
+ labs(x='x', y='y')
+ theme(legend_position='none'))
Run Code Online (Sandbox Code Playgroud)

pandas geom-text plotnine

4
推荐指数
1
解决办法
2578
查看次数

标签 统计

geom-text ×1

pandas ×1

plotnine ×1