How can I create plot for unique and redundant miRNA using ggplot?
0
0
Entering edit mode
20 months ago
khq5801 ▴ 10

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 • 609 views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

output from R script

head command output

ADD REPLY
2
Entering edit mode

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).

ADD REPLY

Login before adding your answer.

Traffic: 3112 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6