'How do I place labels within opaque text boxes at group centroids in ordiellipse?

I'm trying to place labels within opaque text boxes at my group centroids in vegan::ordiellipse().

Code below yields plot below. Note that centroid labels default to plain text with no opaque text box.

library(vegan)

ordiplot(jac_pcoa, main = Trt) 
ordiellipse(jac_pcoa, 
        draw = "polygon",
        kind = "se",
        groups = pcoa_grps, 
        col = col_vect,
        lwd = 2)
ordiellipse(jac_pcoa, groups = pcoa_grps, 
        kind = "ehull", 
        col = col_vect,
        lwd = 2,
        label = TRUE)

enter image description here

Function vegan::ordispider(), however, formats the labels as I want.

ordiplot(jac_pcoa, main = i) 
ordispider(jac_pcoa, groups = pcoa_grps, 
            col = col_vect,
            lwd = 2,
            label = TRUE)

enter image description here

How can I achieve labels like those generated by ordispider() when using ordiellipse()?



Solution 1:[1]

There is no option to do this directly, but you can trick the function to do what you want: ordiellipse will draw labels on opaque labels with draw = "polygon". Setting col=NULL or omitting the col argument will only draw non-filled ellipses, and the colour of the border line can be set with argument border.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1