i think you need to post a bit more code, like the setw() function, does this do additional formatting, because it looks like that is all you are missing.
I just assumed some arbitrary values for your function arguments, removed the setw() and added a newline after the x loop, the Yaxis shows fine like this and the X axis is almost there