MomX / Momocs

:dove: Morphometrics using R
http://momx.github.io/Momocs/
51 stars 19 forks source link

Error in plot_LDA #231

Closed sanfilippog closed 1 year ago

sanfilippog commented 1 year ago

Hello,

I am running the following code:

data(bot) bot.f <- efourier(bot, norm=T) bot.pca <- PCA(bot.f) bot.lda <- LDA(bot.pca) plot(bot.lda)

And get the error message: not a valid fac_dispatcher specification, returning NULL Error in hist.default(xy[fac==levels(fac)[1]],xlim=hist.range, ylab=NA, : invalid number of "breaks"

I also get this error message when plotting an LDA with the same ode on my own data. Specifically, it seems that I am not able to plot more than 2 levels using Momocs. For example, the bottle dataset works fine when using plot_LDA and the "whiskey/beer" factor. However, I am unable to get a plot to display when using another factor with more than 2 levels with plot_LDA. plot_LDA creates an empty plot, with now points if there is more than 2 levels.

vbonhomme commented 1 year ago

hi, try plot_LDA() all the best, v

Le lun. 24 juil. 2023 à 19:33, sanfilippog @.***> a écrit :

Hello,

I am running the following code:

data(bot) bot.f <- efourier(bot, norm=T) bot.pca <- PCA(bot.f) bot.lda <- LDA(bot.pca) plot(bot.lda)

And get the error message: not a valid fac_dispatcher specification, returning NULL Error in hist.default(xy[fac==levels(fac)[1]],xlim=hist.range, ylab=NA, : invalid number of "breaks"

I also get this error message when plotting an LDA with the same ode on my own data. Specifically, it seems that I am not able to plot more than 2 levels using Momocs. For example, the bottle dataset works fine when using plot_LDA and the "whiskey/beer" factor. However, I am unable to get a plot to display when using another factor with more than 2 levels with plot_LDA. plot_LDA creates an empty plot, with now points if there is more than 2 levels.

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/231, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFR5VYCPHPX3FWUJSL3XR2WWVANCNFSM6AAAAAA2V47MTA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱

sanfilippog commented 1 year ago

Hi again,

When trying plot_LDA() with more than 2 factor levels, there are no data points displayed. Only the LDA axes with percentages. Percentages seem to be correct however there is no data in the plot. Any advice?

Thank you

vbonhomme commented 1 year ago

bot.lda <- LDA(bot.pca, ~fake) # using fake col so that we have 3 levels bot.lda %>% plot_LDA() # this works like a charm here.

Le mer. 26 juil. 2023 à 22:42, sanfilippog @.***> a écrit :

Hi again,

When trying plot_LDA() with more than 2 factor levels, there are no data points displayed. Only the LDA axes with percentages. Percentages seem to be correct however there is no data in the plot. Any advice?

Thank you

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/231#issuecomment-1652465423, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFWFZHFW3CJUA4N43V3XSF6LNANCNFSM6AAAAAA2V47MTA . You are receiving this because you commented.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱