A genetic model for the dynamics of a quantitative trait is analyzed i
n terms of gene frequencies, linkage disequilibria, and environmental
effects on the trait. In a randomly mating population, at each generat
ion progeny move to niches where they are subject to weak Gaussian sel
ection on the trait, with different fitness levels in the different ni
ches. Initially, the variability of the trait is due to additive loci
with heterozygous homeostasis. The evolution of plasticity is then des
cribed in terms of the invasion of the population by genetic modifiers
that may epistatically affect the trait, its optimum in each niche, t
he strengths of selection, and other parameters characteristic of the
niches. We show that the evolution of trait means within niches depend
s on the overall evolution in the whole system, and in general, optimu
m phenotypic values are not attained. The reaction norm and genotype-e
nvironment interaction may evolve even if the only effects of the modi
fier are on individual rates of dispersal, or on fitness effects resul
ting from the different environments in the different niches; this evo
lution does not require that the modifier affect parameters that influ
ence the values of the trait. It is conjectured that in the least freq
uently reached niches with low fitness levels, the deviations from the
trait optima should be larger than those in more commonly experienced
and less stringent niches. Our analysis makes explicit the different
contribution of between- and within-niche effects on the evolutionary
dynamics of phenotypic plasticity in heterogeneous environments.