  The gas-phase metallicity of galaxies encodes important information about
galaxy evolution processes, in particular star formation, feedback, outflows
and gas accretion, the relative importance of which can be extracted from
systematic trends in the scatter of the mass-metallicity relation (MZR). Here,
we use a sample of low redshift (0.02 < z < 0.055) galaxies from SDSS to
investigate the nature of the scatter around the MZR, the observables and
physical processes causing it, and its dependence on galaxy mass. We use cold
gas masses inferred from optical emission lines using the technique of Scholte
& Saintonge (2023) to confirm that at fixed stellar mass, metallicity and gas
mass are anti-correlated, but only for galaxies up to M*= 10^{10.5} Msun. In
that mass regime, we find a link between the offset of a galaxy from the MZR
and halo mass, using the amplitude of the two-point correlation function as a
proxy for halo mass; at fixed stellar mass, the most gas-poor galaxies reside
in the most massive halos. This observation is consistent with changes in gas
accretion rates onto galaxies as a function of halo mass, with environmental
effects acting on satellite galaxies also contributing. At higher stellar
masses, the scatter of the MZR does no longer correlate with gas or halo mass.
Instead, there is some indication of a link with AGN activity, as expected from
models and simulations that metallicity is set by the interplay between gas in-
and outflows, star formation, and AGN feedback, shaping the MZR and its
scatter.
