I am trying to print a barplot using seaborn
plt.figure(figsize=(16, 6))
g = sns.barplot(x = 'A', y = 'B', data = df)
g.set_xticklabels(g.get_xticklabels(), rotation=90)
However, before the actual plot, there are two cell which get printed with text something like this
out[3]: <Figure size 1152x432 with 0 Axes>
out[3]: [Text(0, 0, 'valueA'),
Text(0, 0, 'valueB'),
....
Text(0, 0, 'valueZ')]
<Actual BarPlot>
How can I suppress the text before the Actual BarPlot
set_ticklabels
returns the tick values. You can either suppress it with a semicolon
g.set_xticklabels(g.get_xticklabels(), rotation=90);
Or assign the return to a name
ticks = g.set_xticklabels(g.get_xticklabels(), rotation=90)
The setting of text is returning the text objs. Thus; if you take them in a variable, then no output would be there.
var = g.set_xticklabels(g.get_xticklabels(), rotation=90)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With