Tuesday, August 27, 2013

New "static" 3D phylomorphospace method

I just developed a new "static" 3D phylomorphospace function; i.e., one that uses R base graphics to simulate three dimensions in a static plot, rather than the rgl library. The advantage of a static plot over a (much more impressive looking) spinning dynamic plot is that it is much easier to modify the plot using base graphics, and it can be exported in standard formats or combined with other plots. Code for this new version is here. The method uses scatterplot3d internally. It is also in a new phytools build (phytools 0.3-40) which can be installed from source.

Here's a quick demo of each method and the different products they create:

> require(phytools)
Loading required package: phytools
> packageVersion("phytools")
[1] ‘0.3.40’
> # simulate tree & data
> tree<-pbtree(n=26)
> tree$tip.label<-LETTERS
> X<-fastBM(tree,nsim=3)
> # first, method="dynamic" (the default)
> xx<-phylomorphospace3d(tree,X)
> movie3d(xx,duration=20,dir=".",movie= "phylomorphospace3d")
Will create: ./phylomorphospace3d.gif
Deleting frames.
> # now, method="static"
> phylomorphospace3d(tree,X,method="static")
> phylomorphospace3d(tree,X,method="static",angle=-30)

Obviously, the dynamic plot makes it a lot easier to see depth in the 3D plot; but the flat plot has the advantage of being something that we can more easily print to a page or combine with other R graphics.

That's it.


  1. Dear Liam,
    I tried to install the newest version phytools because I need to make 3D static graph (I will put it in my next scientific paper), but I did not have any luck.
    Error message was:
    "Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
    cannot open the connection
    In addition: Warning messages:
    1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
    2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
    cannot open compressed file 'phytools_0.3-40.tar.gz/DESCRIPTION', probable reason 'No such file or directory'"

    I tried to do it manually (copied folder to R library but that did not help).

    Do you have any idea what I am doing wrong?
    Also I am trying to turn of taxa labels but without luck...
    Thanks in advance!

    Tanja Vukov

    1. Hi Tanja.

      I believe this method is in the latest CRAN version (phytools 0.3-72), so you should just be able to install directly from CRAN, i.e.:


      and then select a mirror repository.

      Let me know if that does not work.

      All the best, Liam

  2. This comment has been removed by the author.

  3. Dear Liam,

    I know this post is a few years old, but I was wondering if you can assist me with some issues I'm having with using fancyTree() to create a static 3D phylomorphospace plot. The resulting plot is very "squished" and I can't seem to make the margins smaller so that the plot itself is visible. I've tried adding a mar= argument like in scatterplot3d() but it doesn't change anything. I've also tried to reset my graphics default margins, but that does not seem to help either.

    Additionally, I was wondering if it is possible to add phylogenies to an existing plot in order to show multiple in the same plot?

    Thank you so much,

  4. Organizers are an extremely helpful and adaptable introduction apparatus. Embeddings an information sheet and other educational materials, into an all around planned and marked organizer will leave an expert impact on those accepting the data.szkolenia druk 3d

  5. The exchange cushion at that point brings down onto the printing plate for a moment, and as the cushion is compacted pneumatic stress is utilized to exchange the ink from the scratched work of art onto the silicone cushion, leaving a little measure of ink on the printing plate. Cheap A4 Booklet Printing

  6. Each undertaking requires anticipating it to be fruitful. The look for a crisp, spic and span printer additionally starts by arranging, that is, coordinating your printer needs to your PC's capacity to print full shading and monochrome. This will lead you to the most appropriate printer for your PC.3d printed house

  7. Your site is very informative and your articles are wonderful.www.123moviestube.io

  8. Digital printing incorporates a more costly per page when contrasted with more customary counterbalance printing methods by and by that cost is commonly countered with the value diminishing to stay away from the numerous specialized stages in the middle of important to make printing plates.cheap post card printing

  9. Thanks for helping out, excellent information. CAD modeling

  10. I like the valuable information you provide in your articles. I’ll bookmark your weblog and check again here frequently. I’m quite certain I’ll learn plenty of new stuff right here! Best of luck for the next! final cut pro x effects 

  11. A set of rollers pull the paper in from the tray or feeder and advance the paper when the print head assembly is ready for another pass after which another step motor powers the rollers to move the paper in the exact increment needed to ensure a continuous image is printed.
    best cheap 3d printer

  12. I knew it would be a perfect work of art the minute I began perusing the blog.
    3d printed tabletop miniatures

  13. This comment has been removed by the author.

  14. Need a shading printer or high contrast printer? What is your financial plan? When you are knowledgeable with their requirements, nearby, you should update the specialized parts of a printer.what is sublimation

  15. I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent. UV Flatbed Printer