A relation between magnetic field strength and temperature in sunspots