  C$_4$ photosynthesis has independently evolved from the ancestral C$_3$
pathway in at least 60 plant lineages, but, as with other complex traits, how
it evolved is unclear. Here we show that the polyphyletic appearance of C$_4$
photosynthesis is associated with diverse and flexible evolutionary paths that
group into four major trajectories. We conducted a meta-analysis of 18 lineages
containing species that use C$_3$, C$_4$, or intermediate C$_3$-C$_4$ forms of
photosynthesis to parameterise a 16-dimensional phenotypic landscape. We then
developed and experimentally verified a novel Bayesian approach based on a
hidden Markov model that predicts how the C$_4$ phenotype evolved. The
alternative evolutionary histories underlying the appearance of C$_4$
photosynthesis were determined by ancestral lineage and initial phenotypic
alterations unrelated to photosynthesis. We conclude that the order of C$_4$
trait acquisition is flexible and driven by non-photosynthetic drivers. This
flexibility will have facilitated the convergent evolution of this complex
trait.
