An example of analogy and figurative language in popular science writing.
"Sparkling clusters of recently formed blue stars can be seen within the constellation of Perseus.
The blue stars I've just mentioned are very massive and extremely bright – many of them exceed the Sun in luminosity more than ten thousandfold. These are spendthrift stars with lives spent in a riot of energy. Like butterflies, they die almost as soon as they are born. In fact their lives are so short that they never get very far away from the parent cloud of gas. But small stars like the Sun with long lives move far away from their places of birth. By now all traces of the gas cloud in which the Sun was formed have been lost. Even the stars born in the same shower as the Sun have moved apart and are now unidentifiable, like members of a family out of touch with each other."
Fred Hoyle (1960) The Nature of the Universe (Revised ed.), 1960
This passage contains metaphors ('spendthrift' stars). The suggestions that stars are born, from parents, live and die can be seen as metaphors. [Read: The passing of stars. Birth, death, and afterlife in the universe]
The reference to out of touch families might be seen as an analogy.
Read examples of scientific analogies
The comparison with a butterfly is perhaps best seen as simile. This comparison is slightly problematic as some butterflies survive months as butterflies, but even those that only exist in the adult stage for a few days will have already lived for some time as caterpillars and as pupae before emerging as adults.
Read about examples of science similes