This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I create plot for unique and redundant miRNA using ggplot?

group bar plot image taken from an article

I would like to create group bar plot for redundant and unique mirna against the srna length distribution. Given below is the script that I am using in R to create the plot.

ggplot(data=dff1, aes(x=srna_len, y=redundant_reads)) + geom_bar(stat = 'identity')

What should I add to the above script to get a similar plot as shown in the image? I will really appreciate it if you would provide your valuable suggestion.

r ggplot mirna graph

It would help to show the output of your current code and the results of head(dff1).

You should use the pivot_longer function to transform your data into a format that ggplot2 likes. You'll want a column called reads and a second column called source that's either redundant or unique. When you plot with ggplot, you'll change your aes section to look like aes(x = srna_len, y = reads, group = source).

0 answers

No answers yet.

Log in to answer this question.