For the migratory locust, the switch is caused by population density. As the density of the population increases the locust transforms from the solitary phase to the gregarious phase, with intermediate phases.