title: How to place lines below markers in Python?
body: <p>I have to plot multiple lines and their curve fit lines on a single plot. All these lines are plotted using a for loop. Since it is plot using loops the curve fit lines of the succeeding step is plotted over its predecessor as shown in figure.<img src="https://i.stack.imgur.com/lAirL.png" alt="enter image description here"></p>
  
  <p>The reproducible code:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  x = np.array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
               [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
  y = np.array([[4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
               [6, 5.2, 8.5, 9.1, 13.4, 15.1, 16.1, 18.3, 20.4, 22.1, 23.7]])
  
  m, n = x.shape
  
  figure = plt.figure(figsize=(5.15, 5.15))
  figure.clf()
  plot = plt.subplot(111)
  for i in range(m):
      poly = np.polyfit(x[i, :], y[i, :], deg =1)
      plt.plot(poly[0] * x[i, :] + poly[1], linestyle = '-')
      plt.plot(x[i, :], y[i, :], linestyle = '', marker = 'o', markersize = 20)
  plot.set_ylabel('Y', labelpad = 6)
  plot.set_xlabel('X', labelpad = 6)
  plt.show()
  </code></pre>
  
  <p>I can fix this using another loop as:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  x = np.array([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
               [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
  y = np.array([[4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24],
               [6, 5.2, 8.5, 9.1, 13.4, 15.1, 16.1, 18.3, 20.4, 22.1, 23.7]])
  
  m, n = x.shape
  
  figure = plt.figure(figsize=(5.15, 5.15))
  figure.clf()
  plot = plt.subplot(111)
  for i in range(m):
      poly = np.polyfit(x[i, :], y[i, :], deg =1)
      plt.plot(poly[0] * x[i, :] + poly[1], linestyle = '-')
  for i in range(m):
      plt.plot(x[i, :], y[i, :], linestyle = '', marker = 'o', markersize = 20)
  plot.set_ylabel('Y', labelpad = 6)
  plot.set_xlabel('X', labelpad = 6)
  plt.show()
  </code></pre>
  
  <p>which gives me all the fit lines below the markers.</p>
  
  <p><img src="https://i.stack.imgur.com/KB2QO.png" alt="enter image description here"></p>
  
  <p>But is there any built-in function in Python/matplotlib to do this without using two loops?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Only as an example I have used n = 2, n can be greater than 2, i.e. the loop would be run multiple times.</p>
  
  <p><strong>Update 2 after answer</strong></p>
  
  <p>Can I do this for the same line also? As an example:</p>
  
  <pre><code> plt.plot(x[i, :], y[i, :], linestyle = ':', marker = 'o', markersize = 20)
  </code></pre>
  
  <p>Can I give the linestyle a zorder = 1 and the markers a zorder = 3?</p>