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.

15 comments:

  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

    ReplyDelete
    Replies
    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.:

      install.packages("phytools")

      and then select a mirror repository.

      Let me know if that does not work.

      All the best, Liam

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  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,
    Cecina

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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

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

    ReplyDelete
  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 

    ReplyDelete
  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

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

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  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

    ReplyDelete