Another difference between optical and magnetic encoder is the accuracy.
It is a very important thing when talking about encoder, but often ignored.
While resolution is the smallest distance or angle the encoder can measure, accuracy is the difference between the true position and the measured position.
So, if our encoder has 720PPR, it means that the smallest angle measurable is 360°/720=0.5°.
In an ideal encoder accuracy error is 0, then if you count for example 90 pulses, measured angle and real angle are the same: 90*0.5°=45.0°.
In real world accuracy error is never 0. You can check the datasheet of the encoder for this value.
It is usually just called accuracy or Integral non linearity (INL) or Total non linearity (TNL) or linearity error.
If accuracy is ±0.3° and we still count 90 pulses, measured angle is 45.0°±0.3° so real angle, instead, can be anything between 44.7° and 45.3°.
Both magnetic and optical encoders have their inaccuracy, which is usually bigger in magnetic encoders than in optical.
A lot of things affect inaccuracy, for example sources of inaccuracy in optical encoders are mechanical misalignments and code disk print precision.
For magnetic encoders, mechanical misalignments is still an error source, as well as temperature drift or ferromagnetic materials near sensor or magnet.
Nowadays, good magnetic encoders can achieve accuracy of ±0.1°/±0.2°, while optical encoders can go down to a few thousandths of degrees