0
$\begingroup$

I'm trying to generate boxplot from Beta diversity boxplot between two conditions from a phyloseq object.

I have a Morisita-horn distance generated by vegdist fonction :

vegdist<-vegdist(t(otu_table(physeq_genus_3a)), method="horn")#matrice distance Morisita-horn
vegdist<-as.matrix(vegdist)

Now I have a matrix and I would like to somewhat create a mean distance boxplot of the Morisita-horn index winthin two condition like the graph below.

I wanted to do a simple boxplot with ggplot but beacause it is a matrix and not a dataframe, I can't do it.

Any help or suggestions would be more than welcome.

enter image description here

$\endgroup$
1
  • $\begingroup$ Could you please show a bit more of your data, or another test dataset? It would be greate if you could provide enough that we could use it to create a bar plot with error bars. $\endgroup$
    – gringer
    Jun 16 at 12:07
1
$\begingroup$
  1. You can use as.data.frame() or as_tibble() to convert/coerce your matrix to a data frame or a tibble respectively (Technically a tibble is also a data frame). From there you should be fine with ggplot().

  2. I would not use a "dynamite plot" (this is a box plot with error bars like the one in your question), that type of plots conceal the data! This post explains why and remedies.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.