[R] defining group colours in a call to rda

Andrew Halford @ndrew@h@||ord @end|ng |rom gm@||@com
Tue Aug 4 11:48:41 CEST 2020


Hi,

I've been trying to use the output on group membership of the final leaves
in a MRT analysis to define my own colours, however I am not getting the
result I'm after.

Here is the code
fish.pca <-rda(fish_all.hel,scale=TRUE)
fish.site <- scores(fish.pca,display="sites",scaling=3)
fish.spp <-
scores(fish.pca,display="species",scaling=3)[fish.MRT.indval$pval<=0.05,]
plot(fish.pca,display=c("sites","species"),type="n",scaling=3)
points(fish.site,pch=21,bg=MI_fish_all.mrt$where,cex=1.2)
plotcolor <-
c("red","green","blue","aquamarine","magenta")[MI_fish_all.mrt$where]
 fish.pca <-rda(fish_all.hel,scale=TRUE)
plot(fish.pca,display=c("sites","species"),type="n",scaling=3)
points(fish.site,pch=21,bg=plotcolor,cex=1.2)
MI_fish_all.mrt$where

If I run the points command and insert the group membership direct from the
MRT analysis e.g.  bg=MI_fish_all.mrt$where , then the subsequent points
plot up correctly with a different colour for each group.However if I try
to impose my own colour combo with plotcolor.....It prints colours for 2
groups and leaves the rest uncoloured.

The call to  MI_fish_all.mrt$where gives...
 [1] 3 3 8 6 6 9 5 5 9 3 8 6 9 6 5 9 5 3 8 6 9 6 5 9 5 3 3 8 6 6 9 5 5 9 6
9 5 9.

These are the split groupings for all 39 sites in the analysis and there
are 5 numbers corresponding to 5 final leaves in the tree.

I cant see why my colour scheme isnt being recognised.

All help accepted.

Andy


-- 
Andrew Halford Ph.D
Senior Coastal Fisheries Scientist
Pacific Community | Communauté du Pacifique CPS – B.P. D5 | 98848 Noumea,
New Caledonia | Nouméa, Nouvelle-Calédonie

	[[alternative HTML version deleted]]



More information about the R-help mailing list