我觉得我可能没想到明显的东西.我想在同一个图中输入数据帧每一列的方框图,在x轴上我有列的名称.在seaborn.boxplot()这将是groupby每列的等于.
在熊猫我会做
df = pd.DataFrame(data = np.random.random(size=(4,4)), columns = ['A','B','C','D'])
df.boxplot()
Run Code Online (Sandbox Code Playgroud)
产量
现在我想在seaborn得到同样的东西.但是当我尝试sns.boxplot(df)时,我只得到一个分组的boxplot.如何在seaborn中重现相同的数字?
谢谢
现在我想在单独的画布上为每个功能制作boxplot.分离条件是第一列.我有类似的直方图图(下面的代码),但我不能为boxplot制作工作版.
hist_params = {'normed': True, 'bins': 60, 'alpha': 0.4}
# create the figure
fig = plt.figure(figsize=(16, 25))
for n, feature in enumerate(features):
# add sub plot on our figure
ax = fig.add_subplot(features.shape[1] // 5 + 1, 6, n + 1)
# define range for histograms by cutting 1% of data from both ends
min_value, max_value = numpy.percentile(data[feature], [1, 99])
ax.hist(data.ix[data.is_true_seed.values == 0, feature].values, range=(min_value, max_value),
label='ghost', **hist_params)
ax.hist(data.ix[data.is_true_seed.values == 1, feature].values, range=(min_value, max_value),
label='true', **hist_params)
ax.legend(loc='best')
ax.set_title(feature)
Run Code Online (Sandbox Code Playgroud)