title: Plotting pandas multi-index DataFrame with one index as Y-axis and other as X-axis
body: <p>I have a multi-index dataframe that is sampled here:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  from matplotlib import pyplot as plt
  %matplotlib inline
  
  df = pd.read_csv('https://docs.google.com/uc?id=1mjmatO1PVGe8dMXBc4Ukzn5DkkKsbcWY&amp;export=download', index_col=[0,1])
  
  df
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/XkY5W.png" rel="noreferrer"><img src="https://i.stack.imgur.com/XkY5W.png" alt="enter image description here"></a></p>
  
  <p>I tried to plot this so that each column <code>['Var1', 'Var2', 'Var3', 'Var4']</code> in a separate figure, the <code>Country</code> is a curve, and <code>y-axis</code>, and the <code>Year</code> is the <code>x-axis</code></p>
  
  <p>the requested figure would be like this Ms-Excel figure</p>
  
  <p><a href="https://i.stack.imgur.com/T7eqH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/T7eqH.png" alt="enter image description here"></a></p>
  
  <p>I tried to plot it using </p>
  
  <pre><code>f, a = plt.subplots(nrows=2, ncols=2, figsize=(9, 12), dpi= 80)
  
  df.xs('Var1').plot(ax=a[0])
  df.xs('Var2').plot(ax=a[1])
  df.xs('Var3').plot(x=a[2])
  df.xs('Var4').plot(kax=a[3])
  </code></pre>
  
  <p>but it gives <code>KeyError: 'Var1'</code></p>
  
  <p>I also tried the following</p>
  
  <pre><code>f, a = plt.subplots(nrows=2, ncols=2, 
                                figsize=(7, 10), dpi= 80)
  for indicator in indicators_list:
      for c, country in enumerate(in_countries):
          ax = df[indicator].plot()
          ax.title.set_text(country + " " + indicator) 
  </code></pre>
  
  <p>but it returns 3 empty figures and one figure with all the data in it
  <a href="https://i.stack.imgur.com/Qg6Dq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Qg6Dq.png" alt="enter image description here"></a></p>
  
  <p>What is wrong with my trials and What can I do to get what I need?</p>