Lacan's views are based on Roman Jakobson's analysis of language:
According to Jakobson:
Speech implies a selection of certain linguistic entities and their combination into linguistic units of a higher degree of complexity. At the
lexical level this is readily apparent: the speaker selects words and combines
them into sentences according to the syntactic system of the language
he is using [...]. Hence the concurrence of simultaneous entities and the concatenation of successive entities are the two ways in which we speakers combine linguistic constituents.
Any linguistic sign involves two modes of arrangement.
1) Combination. Any sign is made up of constituent signs and/or occurs only in combination with other signs. This means that any linguistic unit at one and the same time serves as a context for simpler units and/or finds its own context in a more complex linguistic unit. Hence any actual grouping of linguistic units binds them into a superior unit : combination and contexture are two faces of the same operation.
2) Selection. A selection between alternatives implies the possibility of substituting one for the other, equivalent to the former in one respect and different from it in another. Actually, selection and substitution are two faces of the same operation.
Selection (and, correspondingly, substitution) deals with entities conjoined in the code but not in the given message, whereas, in the case of combination, the entities are conjoined in both, or only in the actual message. The addressee
perceives that the given utterance (message) is a combination of constituent
parts (sentences, words, phonemes, etc.) selected from the repository of all possible constituent parts (the code). The constituents of a context are in a state of contiguity, while in a substitution set signs are linked by various degrees of similarity which fluctuate between the equivalence of synonyms and the common core of antonyms.
These two operations provide each linguistic sign with two sets of
interpretants, to utilize the effective concept introduced by Charles
Sanders Peirce: there are two references which serve to interpret the sign - one to the code, and the other to the context, whether coded or free, and in each of these ways the sign is related to another set of linguistic signs, through an alternation in the former case and through an alignment in the latter. A given significative unit may be replaced by other, more explicit signs of the same code, whereby its general meaning is revealed, while its contextual meaning is determined bv its connection with other signs within the same sequence.
Thus, we have two "dimensions" : the "horizontal" one, i.e. the message (or context), and the "vertical" one, i.e. the code.
Jakobson maps the dicothomy combination (horizontal) - selection (vertical) on the dicothomy: metonymy-metaphor.
Metaphor works on the relation of similarity, while metonymy works on the relation of contiguity; see this example from Umberto Eco:
Granted that both the «dog» and the «friar» possess the same connotative marker of «fidelity» (to their master) and «defense» (dogs defend their masters and friars defend the principles of the religion) it was easy during the twelfth century to invent for an order of mendicant friars (the Dominicans) the metaphor “dogs of God” (domini canes). [... a ‘similarity’ between semantic markers]. On the other hand [...] substitution by contiguity is based on the fact that, given a ready-made syntagm, established habits will permit one of its elements to be substituted for another. Thus given the accepted semiotic judgment "the
President of the United States officially lives in the White House" it is easy to use "the White House" as a metonymy for "the President of the United
States".
Thus, in both cases, we have substitution; substitution of a signifier w with a new one w' which has a relation with w: a relation of contiguity (metonymy: w and w' are "usually" connected in a sentence) or a relation of similarity (metaphor: w and w' share some connotation).
Consider U.Eco's example of metonymy: if, instead of saying "President Obama declared ..." we say "the White House declared..." we have substituted the signifier "President Obama" (w) with the new signifier "the White House" (w') both denoting in this context the object: the President Obama. The substitution is grounded on a relation of contiguity based on the usual context: "the President lives in the White House".
In the case of metaphor we say "domini canes" instead of "Dominicans"; again we are substituting in the phrase a signifier w ("Dominicans") with a new one w' both denoting in this context the same object: the friars. The substitution is grounded on a relation of similarity between the two based on the fact that the «dog» and the «friar» possess the same connotative marker of «fidelity» (to their master) and «defense».
Finally, Jakobson consider also dreams:
A competition between both devices, metonymic and metaphoric, is manifest in any symbolic process, be it intrapersonal or social. Thus in an inquiry into the structure of dreams, the decisive question is whether the symbols and the temporal sequences used are based on contiguity (Freud's metonymic "displacement" and synecdochic "condensation") or on similarity (Freud's "identification and symbolism").