Skip to content

different symbols to NMDS graph: it works PARTIALLY!??!?

5 messages · cristabel.duran at waldbau.uni-freiburg.de, Marcelino de la Cruz, Jari Oksanen

#
Dear list, 

I have a problem adding points with different symbols to my
NMDS ordination graph.

I performed a NMDS ordination with this vegan function
(metaMSD) as follow:
	metaf <- metaMDS(spp, distance = "bray", k = 3, trymax =
1000, wascores = T, autotrasform = F, shrink=T, noshare =
1) 
spp is my species matrix.

Then, I want to assign different colors and symbols to my
plots ("sites") according to three categories. These
categories are in the vector called pos with the categories
"gap", "border" and "forest".

For that I am using the following functions and commands:

	ScoresNMDS<-scores(metaf)
	plot(metaf,type="none",choices = c(1,3))
	points.metaMDS(ScoresNMDS[pos$for_pos_anl=="border",],
display="sites",choices = c(1,3), pch=16, cex=0.8,
col="green")
	points.metaMDS(ScoresNMDS[pos$for_pos_anl=="gap",],display="sites",choices
= c(1,3),pch=17, cex=0.8, col="black")
	points.metaMDS(ScoresNMDS[pos$for_pos_anl=="forest",],display="sites",choices
= c(1,3), pch=4,col="red",cex=0.8, bg="red")

The problem:
I get a empty ordination graph, were I am able to add the
points corresponding to the first two categories ("border"
and "gap").
The strange thing, is that it is impossible to add the
third category, I get this error message:

	Error in dimnames(x) <- dn : 
	length of 'dimnames' [1] not equal to array extent

Already tried:
- The length of my explanatory variable (pos) have the same
length that the species matrix.
- Changing the name from my open office spreadsheet, in the
case there is a strange character.
- Change colors and symbols.
- etc...etc.

What I also do not understand, is why it works for some
categories of the same vector and why not for the last
category.
The same happens with ordiellipse and ordihull.

I would appreciate your help! 
Thanks in advance and have a nice day!
Cristabel.


Cristabel Dur?n Rangel. PhD Student.
Institute of Silviculture. Faculty of Forest and
Environmental Sciences. University of Freiburg.
Germany
Telf: +49 (761) 203 8604 (ofc) 

?Man lernt die Physiognomie einer Landschaft desto besser
kennen, je genauer man die einzelnen Z?ge auffa?t, sie
untereinander vergleicht und so auf dem Wege der Analysis
den Quellen der Gen?sse nachgeht, die uns das gro?e
Naturgem?lde bietet.?
				Alexander von Humboldt, 1799
#
Hola Marcelino,

I did now what you suggested,
the lengths of dim(ScoresNMDS) [1] and
length(pos$for_pos_anl) are the same.
and all the three categories exits in the vector...
I still do not find the solution for the problem.

thank you for your fast answer! 
Cristabel.

On Thu, 13 Jan 2011 09:47:41 +0100
Marcelino de la Cruz <marcelino.delacruz at upm.es> wrote:
points.metaMDS(ScoresNMDS[pos$for_pos_anl=="gap",],display="sites",choices
points.metaMDS(ScoresNMDS[pos$for_pos_anl=="forest",],display="sites",choices
Cristabel Dur?n Rangel. PhD Student.
Institute of Silviculture. Faculty of Forest and
Environmental Sciences. University of Freiburg.
Germany
Telf: +49 (761) 203 8604 (ofc) 

?Man lernt die Physiognomie einer Landschaft desto besser
kennen, je genauer man die einzelnen Z?ge auffa?t, sie
untereinander vergleicht und so auf dem Wege der Analysis
den Quellen der Gen?sse nachgeht, die uns das gro?e
Naturgem?lde bietet.?
				Alexander von Humboldt, 1799
#
On 13/01/11 11:03 AM, "cristabel.duran at waldbau.uni-freiburg.de"
<cristabel.duran at waldbau.uni-freiburg.de> wrote:

            
Cristabel,

Do not argue with computers: you'll lose. If the computer doesn't find an
item, it doesn't exist. Computers are more pedantic than we humans, and they
are correct. It may happen, for instance, that the name of your item is
"forest " (note the blank), and then there is no "forest" (note the missing
blank). It is rather easy to see what you get with

ScoresNMDS[pos$for_pos_anl=="forest",]

If those three cases you listed in your message are the only things that you
should display, the following (or a variant of this) should work if 'metaf'
is a metaMDS() result, and pos$for_pos_anl is a factor where levels are
ordered as c("border", "gap", "forest"):
 
plot(metaf,type="none",choices = c(1,3))
## must be a factor
indx <- as.numeric(pos$for_pos_anl)
points(metaf,
display="sites",choices = c(1,3),
  pch=c(16,17,4)[indx], cex=0.8,

  col=c("green", "black", "red")[indx] )
## these use internal ordering of levels: check
legend("topleft", levels(pos$for_pos_ani), pch=c(16,17,4), col =
c("green","black", "red"))

All this is completely unchecked, and probably your factor levels are in
different order and you must change the arguments correspondingly.

Cheers, Jari Oksanen

Cheers, jari Oksanen
#
Hi Jari abd Marcelino,

I'm embarrassed......(flushed face).
It was the missing blank!

Thanks a lot!
and have a nice day!
Cristabel.


 On Thu, 13 Jan 2011 11:51:42 +0200
Jari Oksanen <jari.oksanen at oulu.fi> wrote:
Cristabel Dur?n Rangel. PhD Student.
Institute of Silviculture. Faculty of Forest and
Environmental Sciences. University of Freiburg.
Germany
Telf: +49 (761) 203 8604 (ofc) 

?Man lernt die Physiognomie einer Landschaft desto besser
kennen, je genauer man die einzelnen Z?ge auffa?t, sie
untereinander vergleicht und so auf dem Wege der Analysis
den Quellen der Gen?sse nachgeht, die uns das gro?e
Naturgem?lde bietet.?
				Alexander von Humboldt, 1799