A number of flowers are known to protect your garden both from pests and to store nutrients for later use in the soil. The use of flowers in a garden to treat common problems has been known for a long time. In fact, the song "I'm a Lonely Little Petunia (in an Onion Patch)," written in the late 1940s, mentions one combination of companion flowers. By planting certain flowers in specific vegetable patches, you can discourage pests and help protect your vegetables. The exact flowers that you will plant will depend on the vegetables in your garden.
Plant chrysanthemums in areas where you are having trouble with root nematodes. Nematodes are microscopic roundworms that can damage roots of many plants, including tomatoes. Many nematodes are beneficial insects; only a few are garden pests. Chrysanthemums can control nematode infestations. In addition, white chrysanthemums repel Japanese beetles.
Plant lavender to repel fleas and moths. Lavender can also repel whiteflies.
Plant marigolds as a pest deterrent. In addition to reducing parasitic nematodes, like chrysanthemums, they also can deter other insects. Mexican marigolds are said to deter Mexican beetles and to deter wild rabbits. However, marigolds may have a negative effect on bean growth, so do not interplant them with beans. Marigolds can sometimes attract spider mites and slugs, so plant them with caution in areas where these are common pests.
Plant nasturtiums to deter aphids, squash bugs and striped pumpkin beetles. Nasturtiums can also deter wooly aphids, whiteflies and cucumber beetles. Nasturtiums are also said to attract predatory insects that can sometimes help with other insect infestations. With no known negative effects, there is no reason not to place a potted nasturtium or plant a few nasturtiums interspersed with all of your vegetables.
Plant petunias to repel asparagus beetles, leafhoppers and some aphids. They also deter tomato worms and Mexican beetles. Brewing petunia leaves as you would tea produces a natural insect-deterring spray.