title: Python Matplotlib Callouts
body: <p>I've asked the below question before but I am having a hard time trying to implement the example provided in my code to get the labels in a 'callout' or 'Annotation' so the text does not overlap. I am hoping someone would be able to assist me. Here is my previous question.
  <a href="https://stackoverflow.com/questions/43349004/python-piechart-is-it-possible-to-do-callout-labels">Python PieChart (is it possible to do CallOut labels)</a></p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>from collections import Counter
  import numpy as np
  import matplotlib
  import matplotlib.pyplot as plt
  import pandas as pd
  import sqlite3
  import os
  #Connect to Database
  mypath = os.path.abspath(__file__)
  conn =sqlite3.connect('C:\inetpub\wwwroot\db\DeviceRegister.sqlite3')
  #Connect to the sqlite3 database
  cursor = conn.cursor()  # Set cursor as the cursor for plus.sqlite
  #SQL Query
  df = pd.read_sql_query("SELECT devices.id AS id, macs.address AS mac,     oses.name AS os, browsers.name AS browser FROM devices JOIN macs ON devices.mac = macs.id JOIN oses ON devices.os = oses.id JOIN browsers ON devices.browser = browsers.id", conn)
  df_browsers = df.drop_duplicates(subset=['mac','browser'])
  #Get Data
  counterbrowsers = Counter(df_browsers['browser'])
  browser_names = counterbrowsers.keys()
  browser_counts = counterbrowsers.values()
  #Pie Chart
  plt.figure(figsize=plt.figaspect(0.3))
  labels, values = zip(*sorted(counterbrowsers.items(), key=lambda x:   x[1])) #Counteros is the Dictionary-like object we are trying to sort.  
  This 'zip' solves the problem of sorting each of them independently.
  This   
  will sort as pairs, by value.
  labels = ['{0} : {1:1}'.format(i,j) for i,j in zip(labels, values)]
  colors = ['yellowgreen', 'gold', 'lightskyblue',  'lightcoral','#008DB8','#00AAAA','#001CF0','#00FF80','c','m','r','b','#1970','#0038E2','#0055D4','#0071C6','#00E28E', '#00C69C']
  explode = list()
  for k in labels:
  explode.append(0.1)
  def make_autopct(values):
  def my_autopct(pct):
  total = sum(values)
          val=int(round(pct*total/100))
      return '{p:.0f}%  ({v:d})'.format(p=pct,v=val)
  return my_autopct
  pie = plt.pie(values, labels=labels, explode=explode, colors=colors, shadow=True, startangle=90, autopct=make_autopct(values))  
  plt.suptitle('Browsers Analytics', bbox={'facecolor':'0.8', 'pad':7})
  plt.legend(labels, loc="lower right")
  plt.axis('equal') # Set aspect ratio to be equal so that pie is drawn as a circle, # View the plot drop above
  plt.savefig(mypath + 'piebrowsers.png')
  </code></pre>