How long does it take an MP to become party leader?

A tweet from John Rentoul sparked an idea earlier. Essentially, it was pointed out that David Cameron had been an MP for less time than Liz Kendall before seeking the leadership of the Conservative party. This got me to wondering – how long does it generally take an MP to become leader of their party? I’ve charted all post-war party leaders in the infographic below (and, as an added bonus, a comparison with all the current Labour leadership contenders in the infographic below that).