2017-10-24 14 views
0

matplotlibで円グラフをプロットする際に問題が発生しました。現在はチャート自体を適切にプロットしていますが、そのウェッジには小さな問題があります。引数にウェッジプロットを設定すると(例えばlinewidth、linestyleと同じ)、ウェッジ自体ではなく、チャートの下にあるシャドウに対してこれが変更されます。matplotlib円グラフでウェッジのボーダーを設定する方法は?

ウェッジのための適切な境界線を描く方法とシャドウのための方法はありますか?これは今のように見えます。

import matplotlib.pyplot as plt 

pie_chart_labels = ('Failed', 'Passed', 'Disabled') 
pie_chart_colors = ('red', 'green', 'grey') 
pie_chart_exploded = (0, 0.08, 0) 
pie_chart_fig, pie_chart_ax = plt.subplots() 
pie_chart_ax.margins(0.05) 
pie_chart_ax.axis('equal') 
pie_chart_test_results = (8, 5, 2) 

pie_chart_ax.pie(pie_chart_test_results, 
       explode=pie_chart_exploded, 
       labels=pie_chart_labels,  
       colors=pie_chart_colors, 
       shadow=True, 
       counterclock=False, 
       startangle=90, 
       wedgeprops={'linewidth': 1, 'linestyle': 'solid', 'antialiased': True}) 

pie_chart_fig.savefig('PieChart.png') 

シャドウのmatplotlibのボーダー:

enter image description here

答えて

0

ポイントは、あなたのウェッジは、現在設定される可能性のあるエッジラインを持っていないということです。あなたがそれらにエッジを与えるなら、それにいくつかの特性を与えることもできます。それだ

wedgeprops={"edgecolor":"k",'linewidth': 5, 'linestyle': 'dashed', 'antialiased': True}) 

enter image description here

+0

!ありがとう! –

関連する問題