Homegardens are traditional food systems that have been adapted over generations to fit local cultural and ecological conditions. They provide a year-round diversity of nutritious foods for smallholder farming communities in many regions of the tropics and subtropics. In southwestern Uganda, homegardens are the primary source of food, providing a diverse diet for rural marginalized poor. However, national agricultural development plans as well as economic and social pressures threaten the functioning of these homegardens. The implications of these threats are difficult to evaluate, because the structure and functions of the homegardens are not well understood. The aim of the study was to identify patterns and influencing factors in the diversity of homegardens by documenting the floristic diversity and its interactions with spatial, environmental and socio-economic factors. A geographically and socially focused assessment of floristic diversity in 102 randomly selected homegardens in three districts of southwest Uganda was conducted along a deforestation gradient following a human ecology conceptual framework and testing multiple quantitative hypotheses regarding the above mentioned factors. A merged mixed-method approach was followed to provide context and feedback regarding quantitative findings. Results show a high total richness of 209 (mean 26.8 per homegarden) crop species (excluding weeds and ornamentals) dominated by food species, which constituted 96 percent of individuals and 44 percent of all species. Forest-edge homegardens maintained higher plant diversity compared to homegardens in deforested areas and near degraded wetlands. Multiple linear regression models indicated elevation, location, homegarden size, distance to market, additional land ownership (outside the homegarden) and livestock ownership as significant predictors of crop diversity. Cluster analysis of species densities revealed four garden types: ‘diverse tree gardens’, ‘small forest-edge gardens’, ‘large, old, species-rich gardens’, and ‘large, annual-dominated herb gardens’, with 98% correct classification. Location, elevation, and garden size were also important determinants in the cluster assignment. We conclude that the diversity of the studied homegardens may be changing as part of adaptive traditional practices and in response to external drivers. The identified patterns illustrate the importance of homegardens for rural livelihoods and may offer some ways to support farmers to maintain these systems as relevant mechanisms for development in Uganda.