Magnetic fields across the H-R diagram