2017-11-21 4 views
0

matplotlib円グラフ:https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.pie.htmlを使用しています。matplotlib円グラフにzorderを与える方法はありますか?

私はこれらのpiechartを使用するネットワーク図を生成しています。私は、2つの異なるプロセスを描くために、円グラフの中央に線を引いています。私の問題は、私は真ん中、この線を描画するとき、彼らが重なった場合、行が正しくレイヤードされませんので、それは、すべてのpiechartsの岩下重ねるということです。

私はのためのzorderがないことを実現しますmatplotlibの円グラフですが、zorderをエミュレートする方法はありますか?そうすれば、その行にzorderを使用して、その行の上に円グラフを重ねて重ねることができます。

答えて

1

pie()はパッチのリストを返します。これらの個々のパッチはzorder性質を持っているので、あなたはそれらの上のループとは、そのzorder

fig,ax = plt.subplots() 
ax.set_aspect('equal') 
p1,t1 = plt.pie([50,50], center=(0,0)) 
p2,t2 = plt.pie([1,1,1,1], center=(1.2,0)) # this pie-chart is over the first one 

[p.set_zorder(-1) for p in p2] # change the z-order of the patches so that the 
           # 2nd pie-chart ends up below the first one 

enter image description here

を調整することができます
関連する問題