This year we planted cucumbers from hanging baskets as well as the traditional ground cover. The photograph on the top left shows the cucumber plant with vegetables growing in the traditional horizontal orientation. The photo on the top right shows the cucumber plant with the vegetables growing in the vertical orientation, hanging from a basket at the top of a trellis.
The bottom left photo shows the sizable vegetable growing horizontal. Meanwhile, the photo in the lower right shows the cucumber from the hanging basket as smaller and curling up to grow horizontal.
While not a stringently scientific test, the evidence seems to show that cucumbers have DNA that wants the vegetables to grow in the horizontal position.