Understanding the underlying ecological processes that control plant diversity within (α-diversity) and among (β-diversity) forest gaps is important for managing natural forest ecosystems, and it is also a prerequisite for identifying the formation and maintenance mechanisms of forest plant communities. In this study, we focused on the interrelationships among habitat type (gap/non-gap plots), gap size, elevation and environmental factors, and we explored their effects on plant diversity (α-diversity and β-diversity). To do this, a total of 21 non-gap (i.e., closed canopy) plots (100 m 2 ) and 63 gap plots, including 21 with large gaps (200-410 m 2 ), 21 with medium gaps (100-200 m 2 ) and 21 with small gaps (38.5-100 m 2 ),were selected along an elevational gradient in a subalpine coniferous forest of southwestern China. Using structural equation models (SEMs), we analyzed how forest gaps affected plant diversity (α-diversity and β-diversity) along an elevational gradient. The results showed that (1) as elevation increased, unimodal patterns of α-diversity were found in different-sized gaps, and β-diversity showed a consistent sinusoidal function pattern in different-sized gaps. The gap size was positively related to α-diversity, but this effect disappeared above 3500 masl. Moreover, the patterns of α-diversity and β-diversity in non-gap plots were irregular along the elevational gradient. (2) SEMs demonstrated that many environmental factors, such as the annual mean air temperature (AMAT), ultraviolet-A radiation (365 nm, UV-A365), ultraviolet-B1 radiation (297 nm, UV-B297), moss thickness (MT), soil carbon/nitrogen ratio (C/N ratio), NH 4 -N and NO 3 -N, were significantly affected by elevation, which then affected α-diversity and β-diversity. The photosynthetic photon flux density (PPFD), UV-A365 and UV-B297 were significantly higher in plots with forest gaps than in the non-gap plots. Moreover, the PPFD and UV-A365 were positively and directly affected by gap size. Surprisingly, except for the NH 4 -N and the C/N ratios, the below-ground environmental factors showed little or no relationships with forest gaps. All of these effects contributed to plant diversity. Overall, the above-ground environmental factors were more sensitive to gap-forming disturbances than the below-ground environmental factors, which affected α-diversity and β-diversity. The predicted pathway in the SEMs of the elevational effects on α-diversity and 1082 Journal of Geographical Sciences β-diversity was relatively complicated compared with the effects of forest gaps. These results can provide valuable insights into the underlying mechanisms driving the diversity-habitat relationship in the subalpine coniferous forests of southwestern China.