data(flea)
flea_std <- apply(flea[,1:6], 2, function(x) (x-mean(x))/sd(x))
prj <- basis_random(ncol(flea[,1:6]), 2)
p <- render_proj(flea_std, prj)
if (require("ggplot2")) {
ggplot() +
geom_path(data=p$circle, aes(x=c1, y=c2)) +
geom_segment(data=p$axes, aes(x=x1, y=y1, xend=x2, yend=y2)) +
geom_text(data=p$axes, aes(x=x2, y=y2, label=rownames(p$axes))) +
geom_point(data=p$data_prj, aes(x=P1, y=P2)) +
xlim(-1,1) + ylim(-1, 1) +
theme_bw() +
theme(aspect.ratio=1,
axis.text=element_blank(),
axis.title=element_blank(),
axis.ticks=element_blank(),
panel.grid=element_blank())
}
Run the code above in your browser using DataLab