[R] limit bar graph output
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Oct 15 07:50:35 CEST 2018
A reproducible example would help here (you cannot assume we know what type "miRNA" is) but guessing from the use of "reorder" I suspect it is a factor. In which case after you subset you will need to use the droplevels function to remove the unused levels, and then plot that prepared data.
On October 14, 2018 8:51:29 PM PDT, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>If I understand correctly, just subset your sorted data.
>x <- runif(50)
>## 50 unsorted values
>sort(x, dec = TRUE)[1:10]
>## the 10 biggest
>"The trouble with having an open mind is that people keep coming along
>sticking things into it."
>-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>On Sun, Oct 14, 2018 at 7:13 PM Jeff Reichman <reichmanj using sbcglobal.net>
>> R-Help Forum
>> I'm using the following code to reorder (from highest to lowest) my
>> counts. But there are 500 plus and I only need the first (say)
>> do I limit ggplot to only the first 20 miRNA counts
>> ggplot(data = corr.m, aes(x = reorder(miRNA, -value), y = value, fill
>> variable)) +
>> geom_bar(stat = "identity")
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
> [[alternative HTML version deleted]]
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.
Sent from my phone. Please excuse my brevity.
More information about the R-help