  In addition to the well-known gas phase mass-metallicity relation (MZR),
recent spatially-resolved observations have shown that local galaxies also obey
a mass-metallicity gradient relation (MZGR) whereby metallicity gradients can
vary systematically with galaxy mass. In this work, we use our
recently-developed analytic model for metallicity distributions in galactic
discs, which includes a wide range of physical processes -- radial advection,
metal diffusion, cosmological accretion, and metal-enriched outflows -- to
simultaneously analyse the MZR and MZGR. We show that the same physical
principles govern the shape of both: centrally-peaked metal production favours
steeper gradients, and this steepening is diluted by the addition of metal-poor
gas, which is supplied by inward advection for low-mass galaxies and by
cosmological accretion for massive galaxies. The MZR and the MZGR both bend at
galaxy stellar mass $\sim 10^{10} - 10^{10.5}\,\rm{M_{\odot}}$, and we show
that this feature corresponds to the transition of galaxies from the
advection-dominated to the accretion-dominated regime. We also find that both
the MZR and MZGR strongly suggest that low-mass galaxies preferentially lose
metals entrained in their galactic winds. While this metal-enrichment of the
galactic outflows is crucial for reproducing both the MZR and the MZGR at the
low-mass end, we show that the flattening of gradients in massive galaxies is
expected regardless of the nature of their winds.
