Hello, R-Help -

I am trying to plot the results of an ordination from package vegan. The
tricky part for me right now is getting the colors of the ellipses denoting
the 95% confidence intervals of the group centroids to match the colors of
the points for those same groups.

>From and earlier post, I saw the code to make a plot of the ordination using
different colors for my different groups.  My functional code is below:

library(vegan)
comvars <- read.csv("commvars9trim2.csv")
com.mds <- metaMDS(comvars, trace=FALSE)
firefactors <- read.csv("commvars9factors.csv")
plot(com.mds, type = "n")
points(com.mds, dis="si", pch = as.numeric(firefactors$comm4), col =
as.numeric(firefactors$comm4))

This code will generate the ordination and plot it, using the factor levels
from firefactors$comm4 to determine the colors and characters to use in the
plot.

What I would like to do next is plot the ellipses denoting the 95%
confidence intervals of the group centroids, with colors matching those of
the points. The following piece of code plots the centroids:

with(firefactors, ordiellipse(com.mds, comm4, kind = "se", conf = 0.95,  col
= as.numeric(firefactors$comm4)), label = TRUE)

But the above code makes all of the ellipses blue. Blue is the fourth color
in my default palette(), and the first value returned by
as.numeric(firefactors$comm4) is 4. I assume that's not a coincidence, but I
could be wrong.

I have also tried using:

plot(com.mds, display = "sites", type = "p")
with(firefactors, ordiellipse(com.mds, comm4, kind = "se", conf = 0.95,  col
= as.numeric(firefactors$comm4))

But that code also gives me blue ellipses.

Finally, I'd like to label the ellipses. The only way I've found to do that
is by using the ordispider() function. Is there any way to make ordispider
draw no lines? I've tried

with(firefactors, ordispider(com.mds, comm4, col = "green3", label = TRUE,
lty = 3))

My two questions:

1. How do I make the ellipse color match the color of the points each
ellipse represents?

2. How do I label those ellipses, without drawing the dashed lines as per
ordispider()?

Many thanks,

Gabe

-- 
Gabriel I. Yospin

Center for Ecology & Evolutionary Biology
Bridgham Lab
University of Oregon
Eugene, OR 97403-5289

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to