Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6053943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:05:49+00:00 2026-05-23T08:05:49+00:00

I have made a consensus tree (in newick format) and rebranched it using functions

  • 0

I have made a consensus tree (in newick format) and rebranched it using functions from the ape package.

Does anyone know if it is possible to add error bars to the skyline plot?

Cheers!
Input:

>write.tree(ccc)
[1] "(13.1,43.1,28.1,21.1,20.1,4.1,37.1,23.1,29.1,15.1,36.1,40.1,26.1,16.1,33.1,10.1,18.1,6.1,11.1,34.1,2.1,38.1,35.1,8.1,42.1,22.1,5.1,27.1,39.1,17.1,30.1,31.1,41.1,7.1,25.1,3.1,12.1,14.1,1.1,24.1,9.1,32.1,19.1);"

Branched tree and final input:

> write.tree(new_tree)
[1] "   (13.1:1.244090638,43.1:0.1755118382,28.1:4.442071925,21.1:4.866247957,20.1:3.863557777,4.1:0.08206463186,37.1:1.180065627,23.1:4.778251834,29.1:4.65377018,15.1:3.726316827,36.1:3.799621998,40.1:1.707243007,26.1:3.655532246,16.1:2.436848865,33.1:1.315581813,10.1:0.5973169219,18.1:2.561718575,6.1:1.409437305,11.1:4.000977813,34.1:2.769218051,2.1:1.143412833,38.1:2.636477078,35.1:3.435094416,8.1:0.3714309109,42.1:4.429772993,22.1:0.2805716533,5.1:2.991251546,27.1:3.269689628,39.1:1.192241808,17.1:1.866855259,30.1:1.363407132,31.1:3.150236446,41.1:4.079005712,7.1:2.695786237,25.1:2.867184281,3.1:3.351797838,12.1:1.958669939,14.1:3.119812493,1.1:4.864444738,24.1:1.734493783,9.1:3.283970281,32.1:3.055829309,19.1:0.8193949074);"

require(ape)
new_tree<-compute.brlen(ccc,runif,min=0,max=5)
sk1 <- skyline(new_tree)   
sk2 <- skyline(new_tree, 0.0119) 
plot(sk1, show.years=TRUE, subst.rate=0.0023, present.year = 2011, col="red")
lines(sk2,  show.years=TRUE, subst.rate=0.0023, present.year = 2011)
legend(.15,500, c("classic", "generalized"), col="red",lty=1)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:05:49+00:00Added an answer on May 23, 2026 at 8:05 am

    You can use plotCI from package plotrix. Would be fun to append the plot.skyline tree to implement error bars…

    Anyway, this is the code I used to produce the below picture. I used a different data set that comes with the ape package. You’ll have to take care of the details.

    library(ape)
    library(plotrix)
    data(bird.orders)
    
    new_tree <- compute.brlen(bird.orders, runif, min = 0, max = 5)
    sk1 <- skyline(new_tree)   
    
    subst.rate <- 0.0023
    year <- 2011
    m <- sk1$population.size
    lm <- length(m)
    
    plot(sk1, show.years=TRUE, subst.rate = subst.rate, present.year = year, col="red")
    
    plotCI(x = (-c(0, sk1$time))/subst.rate + year, y = c(m, m[lm]),
            uiw = runif(length(sk1$time)+1, min = 1, max = 30), # some random deviation
            #liw = runif(length(sk1$time)+1, min = 1, max = 30), # this one can be missing, see ?plotCI
            add = TRUE,
            pt.bg = NA
    )
    
    legend(.15,500, c("classic", "generalized"), col="red",lty=1)
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made some helper functions that run a simulation using a lot of
I have made a new windows service which works fine using barebone code (just
I have made a class which a form can inherit from and it handles
I have made an application (for my self) for feeds reading, using SyndicationFeed ,
I have made a multiplayer game using the GameKit Framework where 2 iPhones/iPods can
I have made a player that plays mp3 and does the job very well
I have made a very simple Pie Graph generator using Javascript & SVG graphics.
I have made an Axis2 Web Service in Java. I am using Apache Tomcat
I have made a sql database using sql server. This database include images. When
I have made a project in NetBeans IDE using a custom library (a .JAR

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.