With linear reaction norms, there is necessarily an environment where reaction norm slope and elevation are uncorrelated (*G*_{ab} = 0; illustrated in (Lande, 2009), Fig. 1), and in this environment, the trait is ‘canalized’, that is, its phenotypic variance is minimized. We will use this as the reference environment to define elevation, without loss of generality. Although this form of canalization (caused by the crossing of reaction norms) is a natural consequence of assuming linear reaction norms, it should also hold for other kinds of monotonic smooth reaction norms; however, for nonlinear reaction norms, the description of plasticity is more complex.

#### Continent–island model

We first focus on a model of one-way migration from a continent to an island population, where the continent is unaffected by demography and evolution on the island. This will guide our understanding of the influence of gene flow on the evolution of plasticity with immigration into a single deme. In cases where the population on the island has a negative intrinsic rate of increase, this population may be described as a ‘black-hole sink’ (Gomulkiewicz *et al.*, 1999), so we will sometimes refer to it as the sink.

Generations are assumed to be discrete and nonoverlapping. In each generation, *N*_{i} immigrants from the continent move to the island, either before or after development of the plastic phenotype, but before selection. We assume that the continent is at demographic and evolutionary equilibrium, such that the distribution of reaction norms of immigrants before selection does not evolve. Subscript *i* denotes variables among immigrants arriving on the island in the current generation, and subscript *r* denotes variables among residents already there before migration.

The environment of the island is *δ*. The reaction norm genetic parameters *a* and *b* are assumed to have a bivariate normal distribution with mean vector and covariance matrix **G**_{r} on the island before migration and selection, and similarly on the continent with mean vector and covariance matrix **G**_{i}. Immigrants may develop and express the plastic phenotypic response on the continent population before migration, as occurs for animals that migrate after development. In this case **c**_{i} = (1, *ɛ*_{c})^{T} with *ɛ*_{c} the environment on the continent. Alternatively, they may develop and express the plastic response after immigration, like plants that disperse as seeds, in which case **c**_{i} = **c**_{r} = (1, *δ*)^{T}. We assume that *ɛ*_{c} = 0, such that phenotypes are canalized in the core environment on the continent. This would be expected if the mean environment on the continent had remained stable over a long period, enabling the evolution of genetic mechanisms decreasing genetic variance in this environment (Kawecki, 2000).

Selection is assumed to be density independent, although the population is density regulated. The absolute (Wrightian) fitness of individuals with phenotype *z* is

- (1a)

where *N*_{r} and *N*_{i} are the numbers of residents and immigrants before viability selection. The phenotype-dependent component of fitness *W*(*z*) represents viability selection. We assume Gaussian stabilizing selection for an optimum phenotype that is a linear function of the environment with proportionality constant *B* (the environmental sensitivity of selection, Chevin *et al.*, 2010),

- (1b)

where *ω* is the width of the fitness function. The second factor in eqn (1a) is a density-dependent (but phenotype-independent) component of survival and reproduction. is the net reproductive rate, including offspring survival up to migration in the following generation, of an individual with optimum phenotype, and *K* is the carrying capacity of a population composed of such individuals. Density regulation follows the Ricker model (discrete-time equivalent to logistic population growth) and depends on the number of individuals on the island after migration but before viability selection.

The phenotype-dependent component of mean fitness among residents is obtained by integrating (1b) over the phenotype distribution, yielding

- (2a)

where is the strength of stabilizing selection on the mean phenotype of residents. The phenotype-dependent component of mean fitness among immigrants is

- (2b)

with .

with

- (3b)

Where mentioned in the Results, we also include a cost of plasticity, such that more plastic genotypes have lower fitness, regardless of the phenotype they express (van Tienderen, 1991; Dewitt *et al.*, 1998). This is modelled as a separate episode of selection occurring before development of the plastic phenotype (Chevin & Lande, 2010). We assume Gaussian stabilizing selection towards lower absolute plasticity, , with *ω*_{b} the width of the fitness function on plasticity. The strength of stabilizing selection on mean plasticity owing to its cost is , where *G*_{bb} is the genetic variance in plasticity. By analogy with eqns (3a–c), the cost of plasticity changes the mean reaction norm of migrants and residents by , and their genetic covariance matrix by −*γ*_{b}**GLG** in each generation before phenotypic selection, where .

Then, in the entire island population after selection but before reproduction

- (4a)

- (4b)

where , the proportion of immigrants after viability selection in the current generation, measures gene flow. Note that *m* is a dynamical variable that depends on the total island population size as well as the relative fitnesses of migrants and residents. The last term in eqn (4b) gives the change in variances and covariance of reaction norm parameters due to mixing groups with different mean reaction norms. Hence, our model accounts for the increase in genetic variance caused by the build-up of linkage disequilibrium owing to gene flow in a heterogeneous environment (Bulmer, 1971, 1985; Tufto, 2000b). Although this can be neglected when the environment changes smoothly in space (Slatkin, 1978; Lande, 1982; Kirkpatrick & Barton, 1997), it may be important for highly differentiated continent and island populations as modelled here (Tufto, 2000b), but omitted by Ronce & Kirkpatrick (2001). From eqn (4b), mixing populations with different mean reaction norms also generates covariance between elevation and slope on the island, even when there is no covariance at linkage equilibrium.

Viability selection is followed by random mating and reproduction. The mean phenotype is unaffected by reproduction, so denoting with primes values in the next generation,

- (5a)

In contrast, genetic (co)variances are affected by recombination reducing linkage disequilibrium, and by segregation. Assuming the infinitesimal model, such that phenotypes are controlled by many unlinked polymorphic loci (Fisher, 1918; Falconer & Mackay, 1996), the within-family distribution of breeding values is normal, with covariance matrix **G**_{0}/2, where **G**_{0} is the (co)variance at linkage equilibrium. The genetic covariance matrix on the island in the following generation is then

- (5b)

(Bulmer, 1985; Falconer & Mackay, 1996). The within-family covariance between reaction norm elevation and slope is due to pleiotropic effects of alleles on both traits. Because we assume reaction norm elevation *a* is measured in a reference environment where it is uncorrelated to reaction norm slope in the absence of gene flow, **G**_{0} is a diagonal matrix (Lande, 2009).

Mixing migrants and residents could also cause the distribution of phenotypic and breeding values to depart from normality, altering the response to selection in eqns (3a–c). The strongest effect of mixing occurs for *m *=* *1/2, where migrants and residents are in equal numbers before reproduction. Even in this case, the distribution of breeding values in the sink before reproduction is unimodal if , assuming the same covariance matrix **G** in the source and the sink. For *m* ≠ 1/2, gene flow is less likely to cause bimodality in the distribution of breeding values, but may generate skewness (Yeaman & Guillaume, 2009). However, under the infinitesimal model, recombination and segregation during reproduction tend to restore unimodality and normality in the distribution in breeding values in the next generation. Turelli & Barton (1994) showed that, in the limit of the infinitesimal model (many loci with small effects), the genetic evolution of the mean phenotype in response to selection is well predicted by assuming normality, even under strong disruptive selection.

Finally, the population size on the island before migration in the next generation is

- (6)

which completes the dynamical system. There is no analytical solution to eqns (3–6), because they include sums of different exponential terms (transcendental equations). We therefore found the equilibria by iterating numerical recursions of the dynamical system until the relative change in every variable was <10^{−6}. In all cases, the initial plasticity was set to on the continent and the island, with nonzero *α* on the continent assumed to be caused by other unspecified selection on plasticity, such as environmental fluctuations (Gavrilets & Scheiner, 1993; de Jong, 1999; Lande, 2009).

We considered two scenarios of particular interest. In the ‘colonization’ scenario, migrants from the continent enter a previously empty patch, which becomes a black-hole sink. In the ‘sudden immigration’ scenario, a previously well-adapted population at demographic equilibrium (at carrying capacity) on the island suddenly becomes exposed to one-way immigration from a much larger continent population with a different mean phenotype.

#### Cline model

We also studied a spatially explicit model of a cline with local gene flow. We modelled 101 demes evenly spaced along a single spatial dimension characterized by a linear environmental gradient, such that the environment is 0 at the centre of the range and changes from −*δ* to *δ* between the edges of the range. The *per capita* migration rate between adjacent demes is *μ* in each generation, and migrants move to the nearest demes on both sides with equal probability (as in Goldberg & Lande, 2006). Denoting as *d* the distance between adjacent demes, this approximates dispersal in continuous (but finite) space, where the most important parameter is mean-squared dispersal distance, *σ*^{2} = *μd*^{2} (Malécot, 1948; Slatkin, 1978; Lande, 1982; Kirkpatrick & Barton, 1997). We used reflecting boundaries at edges of the geographic space, such that the half of the emigrants from the first and last deme that would move over the edge instead remained in place, and only a proportion *μ*/2 of the local population moved away from the edge demes. The assumption of reflecting boundaries should have little influence on the results provided that the population density is naturally near zero at the edges, as in all of our numerical examples. We assume that because of intrinsic physiological limitations, the carrying capacity of a well-adapted population is larger in intermediate environments at the centre of the range than in extreme environments at the edges. This is described by making the carrying capacity a Gaussian function of space, with maximum *K*_{max} = 100 at the centre of the range (where ɛ = 0) and width *ω*_{K}. Stabilizing selection in each deme is modelled by a Gaussian fitness function as in eqn (1b), except that the deviation of the local environment of selection from the environment of canalization is now a continuous function of space, and hence the mean phenotype may change smoothly in space. We neglect changes in genetic variance, which should be limited in this model as we assume polygenic inheritance and the environment (and hence the local mean breeding value) changes smoothly over space (Slatkin, 1978; Lande, 1982; Kirkpatrick & Barton, 1997), as opposed to the continent–island model above.

We investigated two types of initial conditions, analogous to those for the continent–island model. In the sudden migration scenario, the mean phenotype initially is everywhere at its local optimum, forming a cline that perfectly matches the cline in the optimum, and local population are at carrying capacity everywhere, as would occur without gene flow. In the invasion scenario, the population size initially has a narrow Gaussian distribution with mode at the centre of the range, width equal to the distance between adjacent demes, and mean phenotype 0 everywhere, such that only the local mean phenotype at the centre of the range is at its optimum.