Okay great thanks for the help. I knew about the scaling difference but I was using the convention that all XYZ and RGB values are between 0 and 1. But I did not think you could just “clip” the negative values to zero. I thought of that but just wanted someone else to confirm. I don’t really need “exact” colours anyway.
But I just tried clipping my negative values and the RGB plots look a lot closer to what I expect so I’ll go with that.
Thanks again!