microeco
microeco copied to clipboard
venn diagram levels of the factor
Hi, I tried make the venn plot according to a level of order. But it is not changing. I used following code,
merge samples as one community for each group
dataset4 <- dataset4$merge_samples(use_group = "Host_taxa")
Convert "SampleID" column to a factor with desired order of levels
dataset4$sample_table$SampleID <- factor(dataset4$sample_table$SampleID, levels = c("Black bird", "Mallard", "Wood pigeon", "Nathusius bat"))
dataset1 is a new microtable object
t1 <- trans_venn$new(dataset4) Figure1d<-t1$plot_venn()
But figure still in alphabetical order instead my order. I want the plot in "Black bird", "Mallard", "Wood pigeon", "Nathusius bat" order.
Hi. The current orders depend on the orders of rownames of sample_table or colnames of otu_table, not the factor levels. Please try this.
library(microeco)
library(magrittr)
data(dataset)
d1 <- dataset$merge_samples(use_group = "Group")
t1 <- trans_venn$new(d1)
t1$plot_venn()
d1 <- dataset$merge_samples(use_group = "Group")
d1$sample_table %<>% .[c("CW", "TW", "IW"), , drop = F]
d1$tidy_dataset()
t1 <- trans_venn$new(d1)
t1$plot_venn()
Thanks for your issue. Maybe I should make the factors to be prioritized. I will update it.
It worked for me. Thanks.