python ggplot x轴故障

时间:2019-09-24 19:49:56

标签: python pandas ggplot2

我具有以下数据框,我想使用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")

graph showing bad order of x labels

我该如何解决?

0 个答案:

没有答案