PCA unused argument (x)

Hello to everyone,
I am working with Package 'Momocs' to plot PCA. I have revised my codes according to the manual but still I get this error: Error in layer_morphospace_PCA(., x, position = c("range"), nb = 12, nr = 6, : **
** unused argument (x)

The codes run perfectly when I run line by line but this above error appeared as I run the last line [layer_title(title = "a)", cex =1)] of the below codes:

#PCA
pca_<-PCA(eOTO)

plot_PCA(pca_, ~Station, zoom =0.9, chull = F, eigen = F, morphospace_positions = F, axesnames = F, axesvar = F, points = F) %>%
layer_morphospace_PCA(x, position = c("range"), nb = 12, nr = 6, nc = 5, rotate = 0,
size = 1, col = "#999999", flipx = FALSE, flipy = FALSE,
draw = TRUE)%>%
layer_ellipses( conf = 0.9, lwd = 1, alpha = 0)%>%
layer_axes(lwd = 1)%>%
layer_axesvar(cex=1.5)%>%
layer_ellipsesaxes (conf = 0.5,lwd=1.5)%>%
layer_grid( col = "#999999", lty = 3, grid = 3)%>%
layer_stars(alpha = 0.8)%>%
layer_points( cex=1.3) %>%
#layer_eigen( nb_max =5, cex = 1 )%>%
layer_legend( cex = 1)%>%
layer_title(title = "a)", cex =1)

Thanks for the help. Best regards,

Are you sure that you should use %>% before the line in error? In plot functions (ggplot) I mostly see + . Just a guess

1 Like

Thanks for the comments. These codes work perfectly with older Version (e.g. 1.2.9) of Momocs. Though I revised my codes according to the latest version of this pancake.

By piping in the pca function result to layer morphospace you satisfy x without needing to mention it, so your mention of it as a a param is a fault.
Either remove that, because you use pipe, or don't use pipe and set x= to the value of the plot pca result you want to start with.

1 Like

Thank you so much for the comments. The unedited version of my codes are:

pca_<-PCA(eOTO)

plot_PCA(pca_, ~Station, zoom =0.9, chull = F, eigen = F, morphospace = F, axesnames = F, axesvar = F, points = F) %>%
layer_morphospace(x, position = c("range"), nb = 12, nr = 6, nc = 5, rotate = 0,
size = 1, col = "#999999", flipx = FALSE, flipy = FALSE,
draw = TRUE)%>%
layer_ellipses( conf = 0.9, lwd = 1, alpha = 0)%>%
layer_axes(lwd = 1)%>%
layer_axesvar(cex=1.5)%>%
layer_ellipsesaxes (conf = 0.5,lwd=1.5)%>%
layer_grid( col = "#999999", lty = 3, grid = 3)%>%
layer_stars(alpha = 0.8)%>%
layer_points( cex=1.3) %>%
#layer_eigen( nb_max =5, cex = 1 )%>%
layer_legend( cex = 1)%>%
layer_title( title = "a)", cex =1)

In these codes, in these codes I have replaced morphospace to morphospace_positions and layer_morphospace to layer_morphospace_PCA following the manual of Momocs Version: 1.3.2. Could you kindly revise these codes as I did not understand the procedure you have mentioned. Many thanks once again.
Best regards,

You can also report your question at https://github.com/MomX/Momocs/issues

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.