ggnested relative abundance graph error differing number of rows

56 Views Asked by At

I am trying to produce a ggnested relative abundance bar plot with two levels (Phylum and Family), I am following the tutorial for microeco (https://chiliubio.github.io/microeco_tutorial/composition-based-class.html#trans_abund-class). I've changed the code to fit my own data:

test1 <- trans_abund$new(dataset = dataset, taxrank = "Family", ntaxa = 10, high_level = "Phylum", prefix = "\\|")

test1$plot_bar(ggnested = TRUE, facet = c("coral_species", "compartment"), xtext_angle = 30) 

The first line works but when I run the second line I keep getting the error:

Error in data.frame(group = groups, group_colour = clr_pal[1:n_clrs]) : 
  arguments imply differing number of rows: 0, 1

I have tried looking at the lengths of the different groups, and "Error: object 'clr_pal' not found", I've tried to add in my own colour palette too but this didn't work.

I have also checked my own groups (the taxonomy table, coral_species and compartments) all match up, and also aren't mentioned in the error?

I'm sure it's a simple fix I'm just very stuck! Any suggestions would be greatly appreciated! Thank you in advance from a very tired postgrad!

0

There are 0 best solutions below