The z-axis lets you control which shape get drawn on top and which shapes get drawn behind. The shapes are all generated in a particular order and by default the later shapes are drawn on top of the earlier shapes. You can override this by giving the later shapes a lower z value than the earlier shapes.