title: Python 3 using matplotlib to display pie chart with percentages , TypeError
body: <p>I am making a simple pie chart with matplotlib with only 2 segments. When I add in a variable 'fracs' at the start of the pie command I get an error regarding the "explode" argument. Here is my code :</p>
  
  <pre><code>import matplotlib.pyplot as plt
  
  dataFile = open("data.txt") #open the file with the data
  bigData = dataFile.readlines() #read it into a variable
  bigData2 = [] # make a second list
  
  for line in bigData: #iterate through bigData and make bigData2, a list with lists in it ( 2D list? )
      aData = line.split(",")
      bigData2.append(aData)
  
  transfer = [] #make transfer list holder
  nonTransfer = [] #make nonTransfer list holder
  
  for i in bigData2: #iterate through bigData2 and sort based on contents
      if i[2] == "Request Transferred\n":
          transfer.append(i)
      if i[2] != "Request Transferred\n":
          nonTransfer.append(i)
  
  trans = len(transfer) #get lengths of the lists
  nTrans = len(nonTransfer)
  
  total = trans+nTrans
  
  percentTrans = int((trans/total)*100) #makes percentage values
  percentnTrans = int((nTrans/total)*100)
  
  fracs = [percentTrans,percentnTrans] #make fraction variable
  print(percentnTrans, ",", percentTrans)
  
  #Setup and make the pie chart
  
  labels = 'transfer', 'nonTransfer'
  sizes = trans, nTrans
  colors = 'red', 'blue'
  explode = (0, 0.1)
  plt.pie(fracs , sizes, explode=explode, labels=labels, colors=colors, shadow=True, startangle=90)
  plt.axis('equal')
  plt.show()
  </code></pre>
  
  <p>Most of this can be ignored in my opinion. The two lines I feel may be the source of the problem are when 'fracs' is defined and the plt.pie() line. </p>
  
  <p>Traceback is as follows :</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
    92 , 7   File "C:/Users/LewTo002/Desktop/serReq/dataEdit.py", line 37,
    in 
        plt.pie(fracs , sizes, explode=explode, labels=labels, colors=colors, shadow=True, startangle=90) TypeError: pie() got
    multiple values for argument 'explode'</p>
  </blockquote>
  
  <p>I was basing what I was doing off of ( <a href="http://matplotlib.org/1.2.1/examples/pylab_examples/pie_demo.html" rel="nofollow">http://matplotlib.org/1.2.1/examples/pylab_examples/pie_demo.html</a> ) and ( <a href="http://matplotlib.org/examples/pie_and_polar_charts/pie_demo_features.html" rel="nofollow">http://matplotlib.org/examples/pie_and_polar_charts/pie_demo_features.html</a> ) with the assistance of this documentation ( <a href="http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie" rel="nofollow">http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie</a> ) </p>
  
  <p>Upon further reflection I do feel that the way I defined 'fracs' to be the culprit but I am not entirely sure how ( or if ) I went wrong there. I do appreciate your time and assistance regarding this. </p>