Entering edit mode
4.6 years ago
Kai_Qi
▴
130
I am using ggplot to plot the geneontology results: I use the following code:
p <- ggplot(data=mydata_2, aes(x=Term, y=logPValue), size =1) + geom_bar(stat='identity')
It worked. But When I want to reorder the columns from high to low using y value using:
p <- ggplot(data=mydata_2, aes(x=(Term, -logPValue), y=logPValue), size =0.01) + geom_bar(stat='identity')
it showed an error:
error: unexpected ',' in "p <- ggplot(data=mydata_2, aes(x=(Term,"
Why this happened. I searched a while. A lot of people is using this method.
x=(Term, -logPValue)
there's your error, did you forget the function?I saw a lot of people say it will work. But It did not work in my hand. In the end, I use
mutate(Term = fct_reorder(Term, logPValue))
to make it work.I still do not know the reason.