How can I add a constant percentage to each wedge of a pie chart using matplotlib
<p>Code snippet looks like this</p>

<pre><code>#df is dataframe with 6 rows, with each row index being the label of the sector
plt.pie(df.iloc[:,0], labels= df.index) #plot the first column of dataframe as a pie chart 
</code></pre>

<p>It generates a pie chart like this:</p>

<p><a href="http://i.stack.imgur.com/z9PXx.png" rel="nofollow">Pie Chart with the 6 sectors.</a></p>

<p>As you can see, the sectors kitchen &amp; entertainment are very small. I want to make each sector have a minimum value of 10 degree (1/36 %).</p>

<p>This would effectively mean fitting the data over 300 degrees (10 degree to each sector and we have 6 - Lighting, Entertainment, Kitchen, Cooling, Fridge, Others)</p>

<p>Disclaimer : This is my own question.</p>

<p>What <a href="http://stackoverflow.com/users/3510736/ami-tavory">Ami Tavory</a> has answered is the correct approach. I was thinking it from the perspective of plotting (fitting the data to 300 degrees instead of 360) instead of manipulating the data (which is much simpler, thanks to pandas).</p>

<p>I am just posting a much simpler form of his answer:</p>

<pre><code>degree = 10 #The degree you want to offset each sector with
# Let the number of sectors be N

plt.pie((df.iloc[:,0]*((360 - degree*N)/360) + ((degree * df.iloc[:,0].sum())/360)), labels= df.index)

#The above is simply scaling the data to fit 300 (degree = 10, N = 6)
# and adding a constant value of degree/360 of the total sum to each sector. 
</code></pre>

python pandas matplotlib