0

I am using the following code to get the plot in canonical analysis in vegan package in R. The plot I get is for axes 1 and 2. How can I get a plot for axes 1 and 3.

library (vegan)  
e.data= read.csv (file.choose())
e.data.ca <- cca(e.data)
plot(scores(e.data.ca,display="sites"),type="p", cex=3*log(rowSums(e.data)/max(log(rowSums(e.data))))
text (scores(e.data.ca,display="sites"),row.names(e.data))

When I add this code : choices= c(1,3) to it:

plot (scores(e.data.ca,display="sites"),type="p", choices=c(1,3),  cex=3*log(rowSums(e.data)/max(log(rowSums(e.data))))

I get the following error:

Error: unexpected symbol in:

"plot(scores(e.data.ca,display="sites"),type="p", choices=c(1,3),  cex=3*log(rowSums(e.data)/max(log(rowSums(e.data))))
    plot"

Warning messages:

1: In plot.window(...) : "choices" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "choices" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :

"choices" is not a graphical parameter 4: In axis(side = side, at = at, labels = labels, ...) : "choices" is not a graphical parameter 5: In box(...) : "choices" is not a graphical parameter 6: In title(...) : "choices" is not a graphical parameter

Any hint would be greatly appreciated

PKumar
  • 10,971
  • 6
  • 37
  • 52
M. arman
  • 11
  • 3
  • That is because "choices" is not a graphical parameter, i.e. it is not one of the parameters that `plot` accepts as an argument. What is it that you are trying to accomplish by including this argument? – G5W Jun 23 '18 at 11:44
  • I want to show the distribution pattern of species also along axes 1 and 3 as well. is there any R-code to show this in Canonical analysis? – M. arman Jun 23 '18 at 12:57
  • Your call to `choices` needs to go inside of the `scores` function, not `plot`, e.g., `plot(scores(e.data.ca, choices=c(1,3))...)` – Esther Jun 23 '18 at 20:19
  • Do **not** use `scores()`, but `plot` the ordination result object directly: `plot (e.data.ca,display="sites",type="p", choices=c(1,3), cex=3*log(rowSums(e.data)/max(log(rowSums(e.data))))`. This will use function `vegan:::plot.cca()` that knows about `choices`. (The `vegan:::scores.cca()` function also knows `choices` like told in some answers, but it is still preferable to plot directly the ordination result than circulate via `scores`.) – Jari Oksanen Jun 24 '18 at 09:35

0 Answers0