title: How to check if colorbar exists on figure
body: <p><strong>Question: Is there a way to check if a color bar already exists?</strong> </p>
  
  <p>I am making many plots with a loop. The issue is that the color bar is drawn every iteration!</p>
  
  <p><a href="https://i.stack.imgur.com/KgLYj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KgLYj.png" alt="enter image description here"></a></p>
  
  <p>If I could determine if the color bar exists then I can put the color bar function in an if statement.</p>
  
  <pre><code>if cb_exists:
      # do nothing
  else:
      plt.colorbar() #draw the colorbar
  </code></pre>
  
  <p>If I use multiprocessing to make the figures, is it possible to prevent multiple color bars from being added?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import multiprocessing
  
  def plot(number):
      a = np.random.random([5,5])*number
      plt.pcolormesh(a)
      plt.colorbar()
      plt.savefig('this_'+str(number))
  
  # I want to make a 50 plots
  some_list = range(0,50)
  num_proc = 5
  p = multiprocessing.Pool(num_proc)
  temps = p.map(plot, some_list)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lzlSF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lzlSF.png" alt="enter image description here"></a> </p>
  
  <p>I realize I can clear the figure with plt.clf() and plt.cla() before plotting the next iteration. But, I have data on my basemap layer I don't want to re-plot (that adds to the time it takes to create the plot). So, if I could remove the colorbar and add a new one I'd save some time.</p>