This is a test version of Biostars. For the public version, visit https://www.biostars.org.
error in reorder the bars of ggplots

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.

rna-seq r rna-seq software error

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.

x =reorder(Term, -logPValue) should work

0 answers

No answers yet.

Log in to answer this question.