我具有以下数据框,我想使用ggplot
库绘制图形:
Voucher amount Multiple buys Single buy
Voucher amount
0 0 0.0716734 0.0293548
5 5 0.0832742 0.05116
10 10 0.096298 0.0732953
15 15 0.107108 0.0967085
问题是x轴刻度标签的顺序错误:
ggplot(aes(x='Voucher amount'), data=dfpercentages) +\
geom_line(aes(y='Multiple buys'), color='blue') +\
geom_line(aes(y='Single buy'), color='red') +\
xlab("Voucher amount") + ylab("%") + ggtitle("Percentages of multi-buying and single-buying users")
我该如何解决?