Reputation: 17617
I am plotting grouped panda data frame
score = pd.DataFrame()
score['Score'] = svm_score
score['Wafer_Slot'] = desc.Wafer_Slot[test_index].tolist()
gscore = score.groupby('Wafer_Slot')
score_plot = [score for ws, score in gscore]
ax = gscore.boxplot(subplots=False)
ax.set_xticklabels(range(52)) # does not work
plt.xlabel('Wafer Slot')
plt.show()
It is working well but the x
axis is impossible to read as there are numerous numbers overlapping. I would like the x
axis be a counter of the boxplot.
How can I do that?
Upvotes: 1
Views: 1070
Reputation: 8906
The boxplot
method doesn't return the axes object like the plot
method of DataFrames and Series. Try this:
gscore.boxplot(subplots=False)
ax = plt.gca()
ax.set_xticklabels(range(52))
The boxplot
method returns a dict
or OrderedDict
of dicts
of line objects by the look of it.
Upvotes: 3