Pandas基地取代了XTICK

2024-05-28 19:00:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在绘制分组熊猫数据帧

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()

它工作得很好,但是x轴是不可能读取的,因为有许多数字重叠。我希望x轴是boxplot的计数器。在

我怎么能做到呢?在


Tags: 数据testdataframe绘制pltaxdescpd
1条回答
网友
1楼 · 发布于 2024-05-28 19:00:45

boxplot方法不像DataFrames和Series的plot方法返回axes对象。试试这个:

gscore.boxplot(subplots=False)
ax = plt.gca()
ax.set_xticklabels(range(52)) 

boxplot方法按外观返回line对象的dict或{}。在

相关问题 更多 >

    热门问题