sinhrks / ggfortify

Define fortify and autoplot functions to allow ggplot2 to handle some popular R packages.
Other
527 stars 65 forks source link

"colour" vs "color" when calling autoplot on a PCA #224

Closed lcmurtaugh closed 1 year ago

lcmurtaugh commented 2 years ago

When I follow your sample code to plot a PCA object, but call color= instead of colour=, the argument is ignored.

library(ggfortify)
library(cowplot)
pca_res <- prcomp(iris[1:4], scale = TRUE)
british <- autoplot(pca_res, data=iris, colour='Species')
us <- autoplot(pca_res, data=iris, color='Species')
plot_grid(british, us,  labels=c('colour', 'color'))

I think this is the only time I've ever encountered a difference between the American and British spellings.

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] cowplot_1.1.1    ggfortify_0.4.14 ggplot2_3.3.5  

image3

terrytangyuan commented 2 years ago

We can add a new argument that are aliases to the existing colour argument. Would you like to submit a PR to contribute?