I can only think of 2 causes; either there's a misalignment btw the sensor and it's physical casing as it comes from the factory or (really and/or) the metal in the traces of the PCB alter the magnetic field enough to distort it's direction. The latter is common in boat compasses (due to metal and wiring near the compass) and good ones will allow you to correct for deviation. In any case so long as your correction holds over time, it's all good but people should be aware that such a calibration is needed for applications that need some degree of absolute accuracy.jremington:
… but I don’t understand where that angle comes from. Maybe there is some interaction between the magnetometers, but such a large angle is commonly reported! In the 3D magnetometer case the procedure is the same except that you have to fit an ellipsoid and align two of its axes