[MRG] DOC Lines up features in permutation importance example
@@ -55,12 +55,14 @@ result = permutation_importance(clf, X_train, y_train, n_repeats=10,
perm_sorted_idx = result.importances_mean.argsort()
tree_importance_sorted_idx = np.argsort(clf.feature_importances_)
-tree_indicies = np.arange(1, len(clf.feature_importances_) + 1)
+tree_indices = np.arange(0, len(clf.feature_importances_)) + 0.5
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 8))
-ax1.barh(tree_indicies, clf.feature_importances_[tree_importance_sorted_idx])
+ax1.barh(tree_indices,
+ clf.feature_importances_[tree_importance_sorted_idx], height=0.7)
ax1.set_yticklabels(data.feature_names)
-ax1.set_yticks(tree_indicies)
+ax1.set_yticks(tree_indices)
+ax1.set_ylim((0, len(clf.feature_importances_)))
ax2.boxplot(result.importances[perm_sorted_idx].T, vert=False,
labels=data.feature_names)
fig.tight_layout()
