geomorphR / geomorph

Geomorph is a software package for performing all stages of geometric morphometric shape analysis of landmark points and curves in 2-and-3-dimensions as well as 3D surfaces in the R statistical computing environment. This repository is dedicated to providing stable and beta versions between CRAN uploads
73 stars 20 forks source link

Issue with plot.gm.prcomp #35

Closed sjm5467 closed 2 years ago

sjm5467 commented 3 years ago

I used to run code to create a tangent space using plot.gm.prcomp and then us plot3d to create a great rotatable PCA plot. Now when I run my code I get:

Error in plot.gm.prcomp(scaled_points, axis1 = 1, axis2 = 2, warpgrids = FALSE, : could not find function "plot.gm.prcomp"

Did this function change? Thanks!

mlcollyer commented 3 years ago

You should not use plot.gm.prcomp(my.gm.prcomp.object), but use plot(my.gm.prcomp.object). The plot.gm.prcomp function is an S3 generic function http://adv-r.had.co.nz/S3.html meaning one uses “plot” and it knows what to do because of the gm.prcomp class of the object.

I believe a few versions back, CRAN changed how R handles S3 generics. It used to be that S3 functions were exported but now they are considered internal, or one has to try to explicitly export them. An alternative is to use:

geomorph:::plot.gm.prcomp(my.gm.prcomp.object)

if you do not want to have the function treated as an S3 function.

Mike

PS, if the link did not work: http://adv-r.had.co.nz/S3.html http://adv-r.had.co.nz/S3.html

On Sep 2, 2021, at 11:52 AM, sjm5467 @.***> wrote:

I used to run code to create a tangent space using plot.gm.prcomp and then us plot3d to create a great rotatable PCA plot. Now when I run my code I get:

Error in plot.gm.prcomp(scaled_points, axis1 = 1, axis2 = 2, warpgrids = FALSE, : could not find function "plot.gm.prcomp"

Did this function change? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/geomorphR/geomorph/issues/35, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUNU4VXLW5QNWTJ5G37HTLT76MVJANCNFSM5DJNZMYQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.