Cl S1 S2 S3
A 39 42 40
B 15 20 18
C 15 4 10
D 4 5 5
I have a excel sheet with clade names A,B,C and D of 3 samples S1,S2 and S3 having relative abundance values shown above.
I want to make a Stacked Bar chart and used this code.
library("readxl")
library(dplyr)
library(ggplot2)
library(scales)
read_excel("relative_abundance(1).xlsx",sheet = "Only_P")
ggplot(data, aes(fill=CL, lable=y, x='S1')) +
geom_bar(position="dodge", stat="identity")
But I didn't succeed. I am new to R and don't know much can anyone please help me.
I want to make a stacked bar chart as the image I have attached.
Please use the formatting bar (especially the
code
option) to present your post better. You can use backticks for inline code (`text` becomestext
), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.Thank you for helping.I will keep in mind your valuable suggestions.