position_dodge2()是否适用于带有plotine的python?

问题描述 投票:0回答:1

我在带有plotine的python中使用ggplot,我有这段代码:

my_plot_availability = (ggplot(df)         
+ aes(x='time_elapsed',y='mean',fill='policy')    
+ geom_bar(position=position_dodge(),stat = "identity", color = "black",size = 0.5)
+ geom_errorbar(aes(ymin='mean-error', ymax='mean+error'), width=.2,position=position_dodge(.9))
+ facet_wrap('mobility')
+ scale_fill_manual(["darkgray", "gray"])
+ labs(x = "Time elpased [s]") 
+ labs(y = "Mean content availability")
+ theme(element_text(family="Times",size=12))
)

绘制此图:

plot

而且我希望具有相同大小的条,即使在某些情况下(如情况0)也只有一个条。我知道我应该这样做:

position=position_dodge2(preserve='single')

但是我在python中遇到以下错误:

NameError: name 'position_dodge2' is not defined

您知道如何解决吗?

python ggplot2 geom-bar python-ggplot plotnine
1个回答
0
投票

您需要将您的皮兰汀版本升级到v0.6.0。

© www.soinside.com 2019 - 2024. All rights reserved.