title: MatPlotLib Dollar Sign with Thousands Comma Tick Labels
body: <p>Given the following bar chart:</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import pandas as pd
  
  df = pd.DataFrame({'A': ['A', 'B'], 'B': [1000,2000]})
  
  fig, ax = plt.subplots(1, 1, figsize=(2, 2))
  
  df.plot(kind='bar', x='A', y='B',
          align='center', width=.5, edgecolor='none', 
          color='grey', ax=ax)
  plt.xticks(rotation=25)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6FmSA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6FmSA.png" alt="enter image description here"></a></p>
  
  <p>I'd like to display the y-tick labels as thousands of dollars like this:</p>
  
  <p>$2,000</p>
  
  <p>I know I can use this to add a dollar sign:</p>
  
  <pre><code>import matplotlib.ticker as mtick
  fmt = '$%.0f'
  tick = mtick.FormatStrFormatter(fmt)
  ax.yaxis.set_major_formatter(tick)
  </code></pre>
  
  <p>...and this to add a comma:</p>
  
  <pre><code>ax.get_yaxis().set_major_formatter(
       mtick.FuncFormatter(lambda x, p: format(int(x), ',')))
  </code></pre>
  
  <p>...but how do I get both?</p>
  
  <p>Thanks in advance!</p>