The line you are setting is the location of the x-y coordinate system, which is independent of the size of the canvas.
Set all the margins to zero and then they will match.
I find it helpful to continue to draw the x and y axes to see that they are scaled correctly (assuming you are overlaying some data).
The axis labels are not exported with the figure as they are outside of the range.
FYI — One shortcut is to create a graph for composition. That creates a canvas with the margins already set to zero.