Is there any way to order elements by their position within the XY-plane? (From top left to bottom right)

Have a look here or here.