Density-dependent habitat selection in plants