title: How to change the order of categorical x-axis in interaction plot in python?
body: <p>So I am generating the interaction plot by using statsmodels package.
  Here in the figure below, you can see my current result.<br />
  I would like to have first &quot;Block&quot; and second &quot;Alternating&quot; in my x-axis. I was wondering how to make this change?
  Here is my code:</p>
  <pre><code>from statsmodels.graphics.factorplots import interaction_plot
  import matplotlib.pyplot as plt
  fig = interaction_plot(x=d['Group'], trace=d['Condition'], response=d['Asynch'],
      colors=['blue','yellow','green','gray'])
  plt.rc(&quot;figure&quot;)
  plt.rc('xtick', labelsize=24) 
  plt.rc('ytick', labelsize=24)
  plt.xlabel('Condition', fontsize=28)
  plt.ylabel('IRI (ms)', fontsize=28)
  sns.set(font_scale = 1.4)
  plt. legend(loc='upper center', prop={'size': 24})
  plt.legend(loc='upper right')
  plt.ylabel(&quot;Asynchrony (ms)&quot;)
  plt.show()
  # plt.savefig('interaction.png', dpi=300)
  fig.savefig('interaction.png', dpi=600)
  </code></pre>
  <p>and here is the result:
  <br />
  <a href="https://i.stack.imgur.com/vcVnT.jpg" rel="nofollow noreferrer">My interaction plot</a></p>