Looking into the misshape of the graph. in it's current state it looks more like the pdf ploat, but it's augmented by about -1 in the y direction. I suspect this may be caused by a step of math that is missing.
added a rotation and translation to line things up (still looks strange)