I've seen several questions about the order of x axis marks but still none of them could solve my problem. I'm trying to do a density plot which shows the distribution of people by percentile within each score given like this
library(dplyr); library(ggplot2); library(ggtheme)
ggplot(KA,aes(x=percentile,group=kscore,color=kscore))+
xlab('Percentil')+ ylab('Frecuencia')+ theme_tufte()+ ggtitle("Prospectos")+
scale_color_brewer(palette = "Greens")+geom_density(size=3)
but the x axis mark gets ordered like 1,10,100,11,12,..,2,20,21,..,99 instead of just 1,2,3,..,100 which is my desired output
I fear this affects the whole plot not just the labels
KA$percentile = as.numeric(as.character(KA$percentile))
. – Gregor Thomasdput(head(KA))
would help confirm this – jeremycgdput(droplevels(head(KA)))
would be better. – Gregor Thomas