title: Creating multiple plots in only one axes using a for loop in python
body: <p>I have a dataframe that I'm trying to plot in a single axes. It has 5 different columns, where the first 4 columns are the y-axis and the 5th column is the x-axis.</p>
  <p>I am trying to make a for loop based on the the dataframe's column name and loop the data and plot them into one figure.</p>
  <p>Below is an example where &quot;names&quot; is the variable that contains the dataframe &quot;df&quot;'s column headers.</p>
  <pre><code>df = pd.DataFrame(data) # Column heads contains {&quot;A&quot; &quot;B&quot; &quot;C&quot; &quot;D&quot; &quot;X&quot;}
                 
  names = []
  for col in df.columns:
      names.append(col)
  
  del names[-1]
  
  for head in names:
      fig,ax1 = plt.subplots(1)
      x = df[&quot;X&quot;]
      y = df[head]
      
      ax1.plot(x, y)
  
  plt.show()
  </code></pre>
  <p>However, this seems to plot multiple graphs in 4 different figures and consequently in 4 separate axes. How could I adjust the code so that it only outputs one figure with a single axes with 4 different lines? Thanks.</p>