Transition metal oxide memristors, or resistive random-access memory (RRAM) switches, are under intense development for storage-class memory because of their favorable operating power, endurance, speed, and density. Their commercial deployment critically depends on predictive compact models based on understanding nanoscale physico-chemical forces, which remains elusive and controversial owing to the difficulties in directly observing atomic motions during resistive switching, Here, using scanning transmission synchrotron x-ray spectromicroscopy to study in-situ switching of hafnium oxide memristors, we directly observed the formation of a localized oxygen-deficiency-derived conductive channel surrounded by a low-conductivity ring of excess oxygen. Subsequent thermal annealing homogenized the segregated oxygen, resetting the cells towards their as-grown resistance state. We show that the formation and dissolution of the conduction channel are successfully modeled by radial thermophoresis and Fick diffusion of oxygen atoms driven by Joule heating. This confirmation and quantification of two opposing nanoscale radial forces that affect bipolar memristor switching are important components for any future physics-based compact model for the electronic switching of these devices.