Entering edit mode
2.4 years ago
khq5801
▴
10
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.
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 calledreads
and a second column calledsource
that's either redundant or unique. When you plot with ggplot, you'll change your aes section to look likeaes(x = srna_len, y = reads, group = source)
.