fawda123 / ggord

a take on ordination plots using ggplot2
https://fawda123.github.io/ggord/
62 stars 20 forks source link

Plotting on variables or cases #5

Closed aedin closed 9 years ago

aedin commented 9 years ago

Hi I have a lot of variables and its creating a messy plot. I can't get var.sub to subset the variables. I wish to either plot only cases, or subset the variables to those which are most variant. Please can you assist me in this Thanks Aedin

fawda123 commented 9 years ago

Hi, here's an example using var_sub:

library(ggord)
library(ade4)
library(FactoMineR)

# dataset and ordination
data(tea, package = 'FactoMineR')
tea <- tea[, c('Tea', 'sugar', 'price', 'age_Q', 'sex')]
ord <- MCA(tea[, -1], graph = FALSE)

# regular
ggord(ord, tea$Tea)

# using var_sub
ggord(ord, tea$Tea, var_sub = c('p_upscale', '+60'))

Please provide a reproducible example if you're still having problems... or maybe I'm misinterpreting the problem. var_sub only removes vectors from the plot and does not change the underlying ordination. I think the better way to do this is to rerun the ordination with subsets of the original data, then plot.

Thanks,

Marcus