3.5 years ago by
Seattle, WA USA
Please see my answer in this thread, which includes a snippet of source for drawing 3D scatterplots in R via
rgl: A: R package used for PCA plotting in a paper (rice RNA-Seq)
As noted in comments, viewing a 3D structure on a 2D surface – like a screen or a piece of paper — can be problematic, in that it is not easy to communicate point depth. It can be easy to misinterpret a figure that shows point clusters, which end up being illusions once the plot is seen from a different angle of rotation.
My answer discusses one way to deal with this problem, namely to make a set of figures rotated at, say, 5 or 10 degree increments, stitched into an animation that shows how points actually disperse.
To reduce the amount of work in making GIF animations, I created a web application called Cubemaker that allows more flexible interaction than the static view that
rgl offers. This tool was made originally to share interactive views of PCA and PCoA datasets, but it will import any three-dimensional dataset, along with optional metadata.
More information about Cubemaker is available here: Cubemaker - visualize three-dimensional datasets via the web and here in this slide deck: https://dl.dropboxusercontent.com/u/31495717/cubemaker/help/overview_pdf.pdf
Cubemaker will let you make color and other metadata changes, reorient the cube, animate its rotation, and share changes and view settings via a persistent web link that can be emailed, posted in a blog, or embedded in a presentation. It is useful for exploring PCA or PCoA results, and if things look genuinely interesting, then more time can be spent on programming
rgl to make a publication-quality figure.