Hello!

I am using ggplot2 (see the code below) to plot the data in 'myplotdata'.
The first column of 'myplotdata' is called "att.levels" and contains
strings; the second column is called "WTP" and contains numeric values.
Notice - I use 'coord.flip()'

The command aes(x=att_levels, y=WTP), if I understand correctly, sorts
things alphabetically based on the column 'att_levels'.
Question 1: How can I reverse the order for x in the plot (also
alphabetically but in the opposite direction)?
Question 2: How can I just have exactly the same order as in the object
'myplotdata'?

Thanks a lot!

ggplot(myplotdata, aes(x=att_levels, y=WTP)) +
                geom_bar(stat="identity",fill="dark orange",colour="black",
alpha = 1,position = "identity") +

geom_text(aes(label=WTP),colour="black",size=4,hjust=1.1,position='dodge') +
                coord_flip() +
                xlab("") +
                ylab("")




-- 
Dimitri Liakhovitski

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to