An historical example of metaphor and analogy in scientific writing:
"It may be divided, 1st, into the period of the alchemists, a lamentable epoch in the annals of intellectual wandering; 2dly, that of the phlogistic doctrines of Beccher and Stahl, in which, as if to prove the perversity of the human mind, of two possible roads the wrong was chosen; and a theory obtained universal credence on the strength of an induction, valid as such, but wrongly interpreted, which is negatived, in every instance, by an appeal to the balance."
Sir John Frederick William Herschel
Herschel, J. F. W. (1830). Preliminary Discourse on the Study of Natural Philosophy.
The alchemists were metaphorically wandering about.
Chemists had a choice of two roads and chose phlogiston theory, which was the wrong choice (implicitly the other road was the oxygen theory of combustion).
Read examples of scientific analogies