1

For some reason, I just can't get this to work. What I end up getting is two grids with axes plotted on top of each other and then the second plot plotted under this. My code works fine for a seaborn distplot:

plt.subplot(121)
h = sns.distplot(dfmain["Runs"])

plt.subplot(122)
j = sns.distplot(dfHighScores["Runs"])

But if I try and plot two factor plots side by side (they are independent so I don't want the axes to be shared), then this just doesn't work as described above:

plt.subplot(121)
h = sns.factorplot("Runs",data=dfmain)

plt.subplot(122)
j = sns.factorplot("Runs",data=dfHighScores)

I get this behavior whether I use an iPython notebook or spyder as my IDE. Any help would be greatly appreciated.

yangjie
  • 6,619
  • 1
  • 33
  • 40
  • 1
    This has been answered here http://stackoverflow.com/questions/23969619/plotting-with-seaborn-using-the-matplotlib-object-oriented-interface – mwaskom Jul 06 '15 at 15:36

1 Answers1

1

According to the documentation of factorplot it should be able do draw two plots side by side by itself. If you combine both your data frames into one (and add a column to tell between them) then something like this should work:

 sns.factorplot("Runs", col="mainOrHighScores", data=dfCombined)

Otherwise I think factorplot doesn't operate on axes (unlike distplot). In any case only functions that have an "ax" parameter for axes can draw on axes.

tal
  • 860
  • 7
  • 19