Unfortunately, just like sometimes we don't care too much for a neighbor or sometimes we just don't get along with someone who lives nearby, plants in the garden also play favorites.
I'm sure you've heard of companion gardening. Companion gardening is nothing more than making sure we place plants that help each other or get along well, near each other. Thus keeping and encouraging harmony in our garden beds.
Following is a list of some common garden plants and their friends and foes. 
Asparagus should never be planted close to potatoes, garlic or onions, but loves marigolds, comfrey, parsley, carrots, tomatoes, coriander, dill and basil.
Basil should not be planted near rue or sage, but loves to be friends with tomatoes, peppers, asparagus and oregano.

Beans add nitrogen to soil so anything you plant in a bed where you have had beans growing previously will love it, in particular corn. Use the greens as an addition to your compost pile. Plant cabbage and other brassicas, radish, cucumbers, celery chard, carrots, eggplant and potatoes near your bean trellises. Pigeon peas are extremely beneficial as a nitrogen fixer in your garden beds.

Beets do well near beans except for runner beans. They fight each other and end up stunting each other's growth. But beets add mineral to the soil and are beneficial to lettuces, onions and brassicas, such as kohlrabi, cabbage, turnip or even mustard greens. Beets like garlic and mint, but it is preferable to grow mint separate, since they tend to run over everything and just use mint clippings as mulch around the beets.
Cabbage doesn't like to be near strawberries, tomatoes, peppers, eggplants, lettuces and pole beans. On the other hand, they get along very well with potatoes, celery, dill and onions. Clover planted along with the cabbages reduces cabbage aphids and cabbageworms by increasing ground beetles that take care of the pests.
Carrots like to be near onions, leaf lettuces and tomatoes, but even though carrots and parsnips or carrots and dill are wonderful cooked together, they do not get along in the garden beds, so keep them apart. If you plant flowers mixed in your edible garden keep asters away from carrots as they can become infected with aster yellow disease.
Celery friends are beans, leeks, onions, spinach, tomatoes and members of the cabbage family. On the other hand, don't put celery near corn or Irish potatoes.
Chards are like celery in that they like to be near beans, tomatoes, onions and members of the cabbage family. Don't plant chard near herbs, corn, melons, cucumbers or squash of any kind; even loofah gourds.
Chives are good friends to tomatoes, carrots, broccoli, cabbage and mustard. Keep away from beans and peas.

Collard greens can be planted in or around basil, beans, cucumbers, dill, garlic, lettuce, marigold, mint, nasturtiums, onion, potato, radish, rosemary, sage and thyme. Do not plant them near grape arbors, rue or tansy.
Comfrey is great for adding calcium, phosphorus and potassium to the garden beds. Comfrey likes it humid and grows well in spots where other plants would rot and is an excellent companion for avocado and other fruit trees. Also attracts snails and keeps them away from other garden plants. When thinning comfrey, chop the leaves back into the soil or add to the compost pile. Your plants will love you!

Cilantro aka Chinese parsley; some people call it coriander, but actually, coriander are the seeds of the plant. I use ground coriander seeds in cooking but I don't particularly care for the taste of the fresh cilantro. A very small amount goes a longs way in my taste buds but, I like to plant it in the garden for two reasons; one the seeds which I like to harvest after the plant bolts and the other is that cilantro repels aphids, spider mites and harmful potato beetles. A tea can be made from the leaves to spray for spider mites. Cilantro is a good companion plant for potatoes, dill, anise and caraway.
Corn has lots of friends in the garden! It is the perfect tall plant for the garden trinity (corn, beans and pumpkins or squash); plant corn and let bean vines go up the stalk and plant the squash around it. Corn, a heavy feeder robs the soil of much nitrogen while growing and the beans will replenish the used up nitrogen to the soil after it dies; the squash will smother weeds and help the corn roots retain moisture. Other plants that can be planted near or among corn are cucumbers, melons, parsley, peanuts, peas and potatoes.
Cucumbers go great with tomatoes in a salad, but according to the garden gurus, they don't play well when together in the garden. They do like corn and beans; and like beans, they would do well growing up the stalks. Carrots, beets, peas, nasturtiums and radishes do well near cucumber. Both beets and dill planted with cucumber help by deterring cucumber beetles and the dill attracts the good predators.
Nasturtiums improve the growth and flavor of cucumbers (and the leaves, stems and blossoms are edible), so mix them all up!

Dill and cabbages love to grow together and it loves to be near lettuces, onions, corn and cucumber, but don't plant it anywhere near carrots or tomatoes. Trimmings from the dill plants can be scattered among squash type plants to repel the squash bug. If planting fennel in the garden, plant it near dill. Fennell kills too many of the plants around it but thrives living near dill.
Eggplants and peppers belong in the same family and like the same growing conditions, so let them hang out together. They also do well near amaranth, peas, beans, thyme, tarragon, spinach and marigolds. Marigolds act as insect repellent and the petals are also edible.

Kohlrabi can be a bit finicky, but if you can get it to grow, plant it near beets! Other plants that do well by kohlrabi are mint, onion, sage, cucumber, oregano, chives and thyme. Keep it away from strawberries, tomatoes, peppers and pole beans.
Lettuce and cabbage don't do well together. The cabbage will affect the taste of lettuce, but you can plant a lot of other things near and around lettuce; dill, broccoli, carrots, cucumber, onions, radishes, strawberries, beets, bush beans and pole beans are just a few of the things that will do well.

Okra is a much unappreciated veggie in many areas and yet it is so versatile! Place peppers and eggplants around okra stalks and they will protect the brittle stems from heavy rain and high winds. Plant lettuce all around okra and the growing plant will shade lettuce during the hottest part of summer and the lettuce will provide moisture to the okra roots. Other plants that get along well with okra are melons, cucumber, basil and black eyed peas. Plant the peas after the okra has had a chance to grow a bit. Aphids will not bother the peas when planted near okra and black eyed peas and okra also make a wonderful gumbo combination in the pot!
Onions are improved when planted near chamomile or summer savory. Carrots, leeks, beets, lettuce, tomatoes, kohlrabi, cabbages, Brussels sprouts, dill and strawberries also benefit from planting near onions. Remember to keep them away from peas and asparagus, though.

Peas and corn go together. Peas replenish nitrogen used up by corn. Carrots, celery, cucumbers, eggplants, early potatoes, spinach, parsley, tomatoes, turnips, strawberries, sweet peppers, bush beans and pole beans benefit from been planted near peas. Don't plant onions, late potatoes, chives or grapes nearby.
Sweet bell peppers like to be near tomatoes, carrots, onions, parsley, basil, marjoram and lovage. They protect okra stems when planted nearby. They do not do well near fennel or kohlrabi. 
Hot peppers enjoy hanging out with eggplants, okra, Swiss chard, tomato, squash, cucumbers, escarole, oregano, basil, rosemary and parsley but don't plant them near beans, cabbage, broccoli, cauliflower, fennel or Brussels sprouts.
Potatoes do well near members of the cabbage family, bush beans, carrot, celery, corn, peas and onions. Marigolds planted around them prevent predators. Don't plant any members of the squash family, including pumpkins, turnip, parsnips, fennel, Kohlrabi, cucumbers and asparagus near potatoes. Also tomatoes and potatoes should be kept apart as they can contaminate each other with blight diseases.
Spinach can be planted near peas and bush beans, as they help protect it from harsh sun. Spinach also plays well with cauliflower and cabbage; strawberries, fava beans, eggplant, celery, peas and squash. Planting it along with squash is space saving as by the time the squash starts getting larger the spinach should be getting ready to bolt and can be pulled.

Tomatoes have lots of friends in the garden! Basil, beans, celery carrots, asparagus, chives, cucumber, garlic, lettuces, mint nasturtiums, marigolds, parsley, peas, peppers, onions all do well around tomatoes. Carrots might not grow as large near tomatoes but they do become more flavorful. Don't plant any corn nearby as they both attract some of the same enemies. Other plants that should be kept away from tomatoes are apricot trees, dill, fennel, cabbage and cauliflower.

Turnips benefit from being planted near peas. You should keep other root vegetables away from turnips as they all will compete for the same nutrients in the soil.
As I mention above, there are some plants that behave like people…. some play nicely with others…some are snooty and very elitist, reserving their favors for a chosen few…. and yet others don’t play well at all with any others!
To read the previous posts on this same topic, please click on the following links: