title: ValueError when plotting pcolormesh with a defined function that has if satements within
body: <p>Consider the following code:</p>
  <pre><code>import matplotlib.pyplot as plt
  import seaborn as sns
  import pandas as pd
  
  x    = np.linspace(1,100,100)
  y    = np.linspace(500,10000,100)
  
  x    = np.unique(x)
  y    = np.unique(y)
  X,Y  = np.meshgrid(x,y)
  
  Z    = myfunction(a,b,c,d,Y,e,f,g,X)
  
  plt.pcolormesh(X,Y,Z)
  
  plt.show()
  </code></pre>
  <p>where a, b, c, d, e, f, and g are values that I arbitrarily set. The problem is that when I run the above code I get the following error:</p>
  <blockquote>
  <p>ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()</p>
  </blockquote>
  <p>because my defined function has 'if' statements within. What could I do to rectify this issue?</p>