Error on PCA axis label when built using autoplot function
Hi ggfortify developer,
I noticed that there're two "almost-identical" documentations on for plotting PCA. One is here (from cran.r-project.org), one is from here(from rpubs.com).
However, the axis for PC1 and PC2 are different (for example, if you look at first plot from the documentations linked above), output from:
library(ggfortify)
df <- iris[c(1, 2, 3, 4)]
autoplot(prcomp(df))
In fact, the PC1 from prcomp(df) should be in a range between -3.2 and 3.7, so, is this a bug in the recent release (v0.4.1)?
Thank you for your time!
@lselzer Could you take a look when you get a chance to see if this is related to your changes? Thanks!
It looks like the scaling parameter is different in the two. In the Rpubs docs scaling is 0 (disabled) while in the package docs is the 1, the default. And I look at my commits and I haven't chaged the scale factor.
Thanks @lselzer for the confirmation!
@nancyxuanhe I am not sure about the RPubs one. But the vignette on CRAN is always up-to-date. Could you show me what how you produced result ranging from -3.2 and 3.7? Here's my result of prcomp and the plot looks matching the one hosted on CRAN.
> prcomp(iris[c(1, 2, 3, 4)])
Standard deviations (1, .., p=4):
[1] 2.0562689 0.4926162 0.2796596 0.1543862
Rotation (n x k) = (4 x 4):
PC1 PC2 PC3 PC4
Sepal.Length 0.36138659 -0.65658877 0.58202985 0.3154872
Sepal.Width -0.08452251 -0.73016143 -0.59791083 -0.3197231
Petal.Length 0.85667061 0.17337266 -0.07623608 -0.4798390
Petal.Width 0.35828920 0.07548102 -0.54583143 0.7536574