I have a dataframe like this
import seaborn as sns
import pandas as pd
%pylab inline
df = pd.DataFrame({'a' :['one','one','two','two','one','two','one','one','one','two'],
'b': [1,2,1,2,1,2,1,2,1,1],
'c': [1,2,3,4,6,1,2,3,4,6]})
A single boxplot is OK:
sns.boxplot(y="b", x="a", data=df, orient='v')
But I want to build a subplot for all variables. I tried:
names = ['b', 'c']
plt.subplots(1,2)
sub = []
for name in names:
ax = sns.boxplot( y=name, x= "a", data=df, orient='v' )
sub.append(ax)
but it outputs:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…