title: How to Plot square, rectangular, hex 2D surface using array method instead of 'for loop'?
body: <p>I am looking for general code which plot square, rectangular, hexagon 2D surface, using initial 2x2 matrix.</p>
  <p>Following is the code I wanted to eliminate'for loop' and instead use simpler array method using numpy. In the bigger picture, I have 8 'for loop' which will slow down my program significantly.</p>
  <pre><code>import numpy as np
  import math
  import matplotlib.pyplot as plt
  
  
  l= 10 #loop limits
  lmit=5#plot limits
  
  # 2x2 matrix
  a = [-0.5, 1];
  b = [1.00, 0.00];
  
  # variable define
  x = np.zeros((2*l, 2*l))
  y = np.zeros((2*l, 2*l))
  
  fig = plt.figure()
  for i in range(-l, l):
      for k in range(-l, l):
          x[i + l, k + l] = (i * a[0] + k * b[0]);
          y[i + l, k + l] = (i * a[1] + k * b[1]);
          plt.scatter(x[i + l, k + l], y[i + l, k + l], s=6, color='Blue')
  
  
  plt.ylim(-lmit, lmit)
  plt.xlim(-lmit, lmit)
  plt.show()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/rzak6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rzak6.png" alt="enter image description here" /></a></p>
  <p>Thanks for any help.</p>