Garden vegetable plants such as garlic, onions, chives, and herbs such as catnip, horehound, wormwood, basil, tansy, and mints all produce scents which seem to repel insects or mask the scents which attract insects. A certain level of insect protection can be achieved by carefully interplanting some of these as companions to vegetables. Many insect pests have specific food preferences while others feed on a wide assortment of hosts. Even those species which feed on a wide variety of hosts, such as Japanese beetles, have preferences for certain plants. It is possible to plant a preferred host as a trap crop near the plant that is being protected.
Many insects are helpful because they eat or parasitize harmful insects.
Most species of wasps and spiders are beneficial as are ground beetles, praying mantids, lady bugs, pirate bugs, and several species of flies. It is possible to attract beneficial insects by planting flowers near the garden. Dill, parsley, carrot, coriander, angelica, and parsnip feature flat topped clusters of small flowers that have strong fragrances. They also seem to attract large numbers of beneficial insects, particularly predatory wasps and flies. This characteristic makes them good candidates for companion planting.