2
votes

In the wine data examples the scatterplot has groups in discrete colours, green, red, etc., but my data comes up with a continuous blue scale which makes it difficult to see the different 'groups';

pca_whales<-read.table("test.txt", header=T)
attach(pca_whales)
model_pca_whales<-prcomp(pca_whales[,1:7],scale=TRUE)
gg_pca <- ggbiplot(model_pca_whales,obs.scale = 1, var.scale=1, groups=pca_whales$sub, ellipse=F,circle=F,varname.size=3)
gg_pca

data:

sub -3dB      -10dB    dur      freq    srt     stfreq

1   0.096     0.336    149.814  27.84   32.993   29.25

2   2.83933   11.2806  272.248  27.8561 239.136  27

3   2.22542   10.8201  221.959  27.0887 203.751  26.25

4   0.782222  15.0756  264.598  27.52   192.073  27.75

I have tried renumbering 'sub' not continuous, but this doesn't affect the display

Any suggestions greatly appreciated.

1

1 Answers

1
votes

If you want a similiar output as in the wine example make soure your variable (pca_whales$sub) is a factor variable. Otherwise you will get the continuous blue scale.