【发布时间】:2022-01-19 11:04:25
【问题描述】:
我正在尝试绘制一些我拥有的数据,并且我正在努力通过 seaborn 进行自动排序。正如您在下图中看到的那样,每个图表的 x 轴排序都不同,我希望它们相同,[Melhorou, Piorou, Indiferente]。有谁知道如何做到这一点?
这是我到目前为止所做的一段代码。
f = plt.figure()
ax = f.add_subplot(2, 2, 1)
sns.despine(f)
sns.histplot(data = data , x = "A pandemia afetou a sua performance acadêmica? [1o sem de 2020]", multiple="dodge", palette = "Blues", ax = ax);
plt.xlabel("1o sem 2020")
ax = f.add_subplot(2, 2, 2)
sns.despine(f)
sns.histplot(data = data , x = "A pandemia afetou a sua performance acadêmica? [2o sem de 2020]", multiple="dodge", palette = "Blues", ax = ax);
plt.xlabel("2o sem 2020")
ax = f.add_subplot(2, 2, 3)
sns.despine(f)
sns.histplot(data = data , x = "A pandemia afetou a sua performance acadêmica? [1o sem de 2021]", multiple="dodge", palette = "Blues", ax = ax);
plt.xlabel("1o sem 2021")
ax = f.add_subplot(2, 2, 4)
sns.despine(f)
sns.histplot(data = data , x = "A pandemia afetou a sua performance acadêmica? [2o sem de 2021]", multiple="dodge", palette = "Blues", ax = ax);
plt.xlabel("2o sem 2021")
【问题讨论】: