title: Matplotlib challenge - changing line style in contour map
body: <p>I would like to use numpy's boolean indexing to plot only regions of a function in which I have a certain condition met - sigma &lt; 0, as in the code bellow. When I try to use numpy's boolean indexing as in this example - <a href="https://stackoverflow.com/questions/9284877/change-matplotlib-line-style-mid-graph">change_line_style</a>, I get TypeError. Is there a way to use numpy's boolean indexing to plot only certain regions using the contour function?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  from matplotlib import rc
  rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
  rc('text', usetex=True)
  
  plt.figure()
  plt.ylim([-2,2])
  plt.xlim([-0.5,0.5])
  
  plt.xlabel(r'\lambda')
  plt.ylabel(r'u')
  
  lambda_x = np.linspace(-0.5,0.5,1000)
  u = np.linspace(-2,2,1000)
  
  X,Y = np.meshgrid(lambda_x,u)
  # Drawing f=0 lines for implicit function f(u;lambda) = lambda*u  + u**3 - u**5
  f1 = X  + Y**2 - Y**4
  f2 = Y
  
  sigma = X + 3*Y**2 - 5*Y**4
  
  stable = sigma &lt; 0
  #plt.setp(zc, linewidth=4)
  print stable.shape
  print f1.shape
  
  plt.contour(X[stable],Y[stable], f1[stable], levels = [0],colors = ('r'),linewidths = 4,extend='both')
  plt.contour(X[stable],Y[stable], f2[stable], levels = [0],colors = ('b'),linewidths = 4,extend='both')
  
  plt.show()
  </code></pre>