Does price affect quantity or vice versa?
This is a common problem among students first learning economics. The way these graphs are displayed are not meant to tell you anything about causality, let along the direction of causality. The reason that price is on the y-axis is partly because of tradition and partly because that's what makes the most sense from the perspective of developing economic theory. 

One of the central questions of economics is the determination of prices. What causes prices to be what they are? So, it maybe seems natural to write relationships that give a price as the dependent variable. However, the layout is not meant to convey any information about causality.