Background and Aims Studies of phenotypic plasticity in plants have mainly focused on (1) the effect of environmental variation on whole-plant traits related to the number of modules rather than on (2) the phenotypic consequences of environmental variation in traits of individual modules. Since environmental and developmental factors can produce changes in traits related to the mating system, this study used the second approach to investigate whether within-individual variation in herkogamy-related traits is affected by the environment during plant development in two populations of Datura stramonium , an annual herb with a hypothesized persistent mixed mating system, and to determine which morphological traits may promote self-fertilization. Methods Full-sib families of two Mexican populations of D. stramonium , with contrasting ecological histories, were grown under low, mid and high nutrient availability to investigate the effects of genetic, environmental and within-plant flower position on flower size, corolla, stamen and pistil lengths, and herkogamy. Key Results Populations showed differences in familial variation, plasticity and familial differences in plasticity in most floral traits analysed. In one population (Ticumán), the effect of flower position on trait variation varied among families, whereas in the other (Pedregal) the effect of flower position interacted with the nutrient environment. Flower size varied with the position of flowers, but in the opposite direction between populations in low nutrients; a systematic within-plant trend of reduction in flower size, pistil length and herkogamy with flower position increased the probability of self-fertilization in the Pedregal population. Conclusions Besides genetic variation in floral traits between and within populations, environmental variation affects phenotypic floral trait values at the whole-plant level, as well as among flower positions. The interaction between flower position and nutrient environment can affect the plant's mating system, and this differs between populations. Thus, reductions in herkogamy with flower positions may be expected in environments with either low pollinator abundance or low nutrients.