title: Add comma separator to seaborn heatmap using set_text from matplotlib and keep dollar sign
body: <p>I would like to add a comma separator to the annotation produced by the following code, keeping the dollar sign and using the <code>set_text()</code> and <code>get_text()</code> functions. I see that t returns a "text object" but I am not sure how to modify the object to return the desired result.</p>
  
  <p>How can I add a comma separator while keeping the dollar sign and using the <code>for t in ax.texts</code> loop?</p>
  
  <p>Code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import pandas as pd
  from random import randint
  import seaborn as sns
  #
  datas = []
  #
  for item in list("ABC"):
      for year in [2012, 2013, 2014, 2015, 2016, 2017]:
          x = randint(1000, 2000)
          datas.append([item, year, x])
  
  df = pd.DataFrame(datas, columns = ["Item", "Year", "Value"])
  df = df.pivot("Item", "Year", "Value")
  ax = sns.heatmap(df, linewidths = 0.5, xticklabels = True, yticklabels = True, cmap = "OrRd", annot = True, fmt = "d")
  
  for t in ax.texts:
      t.set_text("$" + t.get_text())
  
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/7OGmD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7OGmD.png" alt="enter image description here"></a></p>