title: Python. Draw rectangle in basemap
body: <p>I need to add several rectangles in my basemap. I nee four rectangles with lat and log ranges as below.</p>
  
  <p>1) llcrnrlon=-10,  urcrnrlon=10, llcrnrlat=35,urcrnrlat=60</p>
  
  <p>2) llcrnrlon=10.5,  urcrnrlon=35, llcrnrlat=35,urcrnrlat=60</p>
  
  <p>3) llcrnrlon=35.5,  urcrnrlon=52, llcrnrlat=30,urcrnrlat=55</p>
  
  <p>4) llcrnrlon=-20,  urcrnrlon=35, llcrnrlat=20,urcrnrlat=34.5</p>
  
  <p>My script is below. I found "polygon" packages to add lines but I do not exactly know how to do. Please help me!! Thanks a lot for your help in advance!</p>
  
  <pre><code>    from mpl_toolkits.basemap import Basemap
  
       m=basemaputpart.Basemap(llcrnrlon=-60, llcrnrlat=20, urcrnrlon=60, urcrnrlat=70, resolution='i', projection='cyl', lon_0=0, lat_0=45)
  
      lon1=np.array([[-180.+j*0.5 for j in range(721)]  for i in range(181)])
      lat1=np.array([[i*0.5 for j in range(721)]  for i in range(181)  ])
      Nx1,Ny1=m(lon1,lat1,inverse=False)
  
      toplot=data[:,:]
      toplot[data==0]=np.nan
      toplot=np.ma.masked_invalid(toplot)
      plt.pcolor(Nx1,Ny1,np.log(toplot),vmin=0, vmax=5)
      cbar=plt.colorbar()
  
      m.drawcoastlines(zorder=2)
      m.drawcountries(zorder=2)
  
      llcrnrlon = -10
      urcrnrlon =  10
      llcrnrlat =  35
      urcrnrlat =  60
      lower_left = (llcrnrlon, llcrnrlat)
      lower_right= (urcrnrlon, llcrnrlat)
      upper_left = (llcrnrlon, urcrnrlat)
      upper_right= (urcrnrlon, urcrnrlat)
  
      plot_rec(m, lower_left, upper_left, lower_right, upper_right)
  </code></pre>
  
  <p>Then I see "Type Error: 'tuple' object is not callable"</p>
  
  <p>Instead of this part, I added one  you suggested first.</p>
  
  <pre><code>    ..
      m.drawcoastlines(zorder=2)
      m.drawcountries(zorder=2)
  
      def plot_rec(m, lower_left, upper_left, lower_right, upper_right):
          xs = [lower_left[-10], upper_left[-10],
                lower_right[10], upper_right[10]]
          ys = [lower_left[35], upper_left[60],
                lower_right[35], upper_right[60]]
          m.plot(xs,ys,latlon=True)
  
      plt.show()
  </code></pre>
  
  <p>Then I do not see any box in my plot. I have to put another, not plt.show()??</p>
  
  <p>Also, would you let me know how to put number in the box (e.g., 1 in the upper left conner of the box) ? How to get sum of values in all points of my data and get percentage of (sume of values in the box) over (sum of values in all points of my data)? I ask too much.. Just let me know what you can give me, it would be anyway great!!! </p>
  
  <p>THanks a lot!!</p>