Coordinates: Why is the y axis inverted for coding?


For math teachers especially, it can be very annoying that the y axis works in the opposite direction in coding as it does for the math coordinate plane. Why would you make the y axis increase as you go DOWN on the screen? It seems counterintuitive.

This frustrating inversion traces its origins back to early computers, when they were mostly used to display text. In English, we read left-to-right, from top to bottom. Think about the text as a grid, where each character (of equal width) is displayed one at a time. Following the order of the letters in the message you are trying to display, you would increase your letter count as you read each character left to right, and then you would increase the number of rows that you have displayed as you complete each row of text and go down to the next one. Hence x increases as you go to the right, and y increases as you go down.

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.