Polymorphic mimicry and natural selection. Some animals are bad-tasting or dangerous, for example, and predators learn to recognize them by their bright color patterns and leave them alone. Animals that are good-tasting, or cannot defend themselves directly, must resort to other ways to avoid being eaten. There are flies and beetles, for example, that have distinct yellow and black bands and look like yellow jackets , and predators avoid them even though flies and beetles cannot sting like yellow jackets.
Mimicry is a phenomenon in which one organism benefits by a superficial resemblance to another.
After a number of distasteful encounters, a predator learns to avoid prey with this appearance. Many examples of mimicry are found in butterflies. Pipevine swallowtails are bad-tasting because of plant poisons taken into their bodies during larval feeding on pipevine leaves. Several butterfly species that do not take in plant poisons as caterpillars, including red-spotted purples , look very much like the pipevine swallowtails because both species are dark with bluish iridescence and a row of light spots on the hind wings. Thus, the predators leave both species alone.