cropped and incomplete "genus" stacked barplot generated with R
0
0
Entering edit mode
4.5 years ago
dpc ▴ 250

Hi friends, I am using R phyloseq software package for visualisation of data. I don't know why am I getting an incomplete stacked barplot at "genus" level like this (attachment) . I am getting a complete and a nice barplot at the class and Phylum level though. I am using the following code:

# setting the seed to one value in order to created reproducible results

set.seed(1)  

# scaling the human data to the smallest samples. Note: rngseed is similar to set.seed

human_scaled <- rarefy_even_depth(human_data, sample.size=52975, replace=FALSE, rngseed = 1) 

# Make a data frame with a column for the read counts of each sample

plot_bar(human_scaled, fill="Genus")

I am new in R and metagenomic data analysis. And, don't know how can I get the full "genus" level barplot. Can anyone please help me out?

Thanks and Regards, DC7

mothur 16s R software error phyloseq • 1.3k views
ADD COMMENT
0
Entering edit mode

Please host the image on public server. Current location asks for user's google credentials. plot_bar(myData, fill="Genus") is supposed to give you Genus level distribution (color the relative abundance at Genus level). Could you explain what you are looking for with an example?

ADD REPLY
0
Entering edit mode

Sir/Madam, Can you please check this link?

Actually, I want to see the relative abundance of the genus for each sample through a stacked barplot.

ADD REPLY
0
Entering edit mode

I think legend squished the plot. Turn off legend and check if you can see the stacked the bar plot. What you are seeing is the legend of the plot (as I understand from the image, posted). Try some thing like this:

plot_bar(human_scaled, fill="Genus")+
theme(legend.position = "none")
ADD REPLY
0
Entering edit mode

Many many thanks cpad0112. I am getting a complete image now like this. Great relief!!! Can you please tell me why I am seeing that black bands in the image. i mean between two genus some bands are thin and some are considerably very thick.

Thanks DC7

ADD REPLY
0
Entering edit mode

that is border around each genus. If you look at the legend, you would see that each block (genus) is surrounded by black border. see adding +geom_bar(stat="identity") works. But this is not correct. There is a better and correct way to do that. Please look at the package manual.

ADD REPLY

Login before adding your answer.

Traffic: 2140 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