Companion planting can be defined as the close planting of different species based on their ability to enhance one another's growth or offer some form of pest protection or other advantages. Sometimes this is a matter of choosing plants with different growth habits that don't compete with one another or those that have different nutrient needs that make efficient use of soil. Strategic companion planting is especially important in small gardens or wherever careful space planning is needed.
Cucumbers are a rather exuberant crop, with vines that can sprawl over a lot of space, and the healthier the plants, the more space they seem to take. But cucumbers can also "play well" with more other types vegetables than you might first think. For example, because cucumbers typically hug the ground, towering or climbing vegetables and flowers such as corn or sunflowers will stand well above the blanket of cucumber vines. These plants also don't require much in the way of water, and so won't compete with cucumbers for moisture.
Peas and beans are legumes, which have root systems that increase nitrogen in the soil, which will benefit your cucumber plants (as well as many other plants). Marigold flowers will help repel beetles and nasturtiums are distasteful to thrips and other insects. (These flowers make for good companions for almost all vegetables and herb.) Oregano is an herb with a well-establish reputation for repelling insect pests and is another good companion for cucumbers.
Potatoes compete mightily with cucumbers for nutrients and water, so they should not be planted with cucumbers. Other members of the nightshade family, though, such as tomatoes, do not have this effect on cucumbers. Sage seems to attract pests that feast on cucumber leaves, and thus should be avoided.
In general, other ground-hugging vining crops are likely to compete with cucumbers, and therefore should be avoided.
Here are some ideas for the best plants to grow with cucumbers, as well as some you should avoid planting with cucumber.
Good Companions for Cucumbers
Plants to Avoid Growing Near Cucumbers
Cucumbers grow poorly when planted near: