0

I have the Following plot:

```forest = sk.ensemble.RandomForestRegressor(n_estimators=250,random_state=0)
   forest.fit(X, y)
   importances = forest.feature_importances_
   std = np.std([tree.feature_importances_ for tree in forest.estimators_],axis=0)
   indices = np.argsort(importances)[::-1]
   refclasscol=list(df.columns.values)
   impor_bars = pd.DataFrame({'Features':refclasscol[0:20],'importance':importances[0:20]})
   impor_bars = impor_bars.sort_values('importance',ascending=False).set_index('Features')
   plt.rcParams['figure.figsize'] = (10, 5)
   impor_bars.plot.bar()```

Which displays this : here

I want to remove borders and make something like this:here

Is it possible?

kuljot
  • 45
  • 3
  • Yes the borderless is done. If i want the values on y axis to appear in the bars itself, can it be done? – kuljot Nov 23 '20 at 19:33

1 Answers1

1

Typically, people use

plt.axis('off')

to get plots that look like this:

enter image description here

An alternative is adjusting alpha to have very faint borders

enter image description here

The rationale is that the left and bottom axis have the ticks and labels and thus carry information, while the top and right add no value. This style is inspired by the work of Edward Tufte, who recommends that, rather than repeatedly adding emphasis to important elements in a graphic, you apply de-emphasis to unimportant elements.

James_SO
  • 1,169
  • 5
  • 11