私は yhat のggplot ライブラリを使用しています。次の pandas DataFrame があります。
degree observed percent observed expected percent expected
0 0 0 0.0 0 0.044551
1 1 1 0.1 1 0.138604
2 2 3 0.3 2 0.215607
3 3 4 0.4 2 0.223592
4 4 1 0.1 2 0.173905
5 5 1 0.1 1 0.108208
現時点では、次のことを行っています (df
関数の最初の行の最初の行で返されるのは、上記の DataFrame です)。
def chartObservedExpected(graph):
df = observedExpected(graph)
return ggplot(aes(x='degree', y='percent observed'), data=df) + \
geom_point() + \
ylim(-0.015,1.015) + \
xlim(-0.05,max(df['degree']) + 0.25) + \
labs("Degree","Proportion of Total") + \
ggtitle("Observed Node Degree Distribution")
chartObservedExpected(G)
これは私が得るものです:
geom_bar()
ただし、の代わりに試してみるとgeom_point()
、バーは 100% しか表示されません。geom_bar()
プレーンと も試しましgeom_bar(stat="percent observed")
たが、どちらも機能していないようです。これは常に私が得るものです:
私がやろうとしているのは、以下を模倣/再現することです:
バーの部分を機能させる方法はありますか (または全体を)。