O(2)-scaling in finite and infinite volume