title: How to rotate the percentage label in a pie chart to match the category label rotation?
body: <p>I'm working on a personal budget visualization project to build my python competency and have hit a snag in how I want the pie chart to show data. Right now, I have a pie chart with the per-category spending and per-category budgeted spending that has category labels outside the pie chart. The labels are rotated to align with a ray from the center of the pie through the center of the wedge, using &quot;rotatelabels = True&quot; in plt.pie. This works great, but I want the percentage label that displays inside the wedge to also be rotated, so that both the category label and the percentage are parallel to the aforementioned ray. I've been able to rotate all the percentages by a given amount as in the post here: <a href="https://stackoverflow.com/questions/43683513/how-can-i-improve-the-rotation-of-fraction-labels-in-a-pyplot-pie-chart">How can I improve the rotation of fraction labels in a pyplot pie chart</a>
  , but I'd like to refine it to my goal. Any tips on working with text.set_rotation or other functions or parameters to achieve this?</p>
  <p>Code snippet revised to function as standalone from project at large:</p>
  <pre><code>import pandas as pd
  cat = ['Utilities', 'Home', 'Bike', 'Medical', 'Personal', 'Food', 'Groceries', 'Student Loans', 'Transit', 'Rent']
  dict = {8:54.99,14:59.91,3:69.03,10:79.00,9:119.40,1:193.65,0:205.22,4:350.00,7:396.51,2:500.00}
  nonzero_spending = pd.DataFrame(list(dict.items()), columns = ['index_col', 'Sum'])
  plt.pie(nonzero_spending['Sum'],labels=cat,radius = 2,startangle = 160,autopct=lambda p : '{:.2f}%  ({:,.0f})'.format(p,p * sum(nonzero_spending['Sum'])/100), rotatelabels = True, pctdistance=0.8)
  plt.title('Spending')
  plt.axis('equal')
  plt.show()
  </code></pre>