Background: An electron localization function was originally introduced to visualize bond structures in molecules. It became a useful tool to describe electron configurations in atoms, molecules and solids. In nuclear physics, a nucleon localization function (NLF) has been used to characterize clusters in light nuclei, fragment formation in fission and pasta phases in the inner crust of neutron stars. Purpose: We use the NLF to study the nuclear response to fast rotation. Methods: We generalize the NLF to the case of nuclear rotation. The extended expressions involve both time-even and time-odd local densities. Since current density and density gradient contribute to the NLF primarily at the surface, we propose a simpler spatial measure given by the kinetic-energy density. Illustrative calculations for the superdeformed yrast band of $^{152}$Dy were carried out by using the cranked Skyrme-Hartree-Fock method. We also employed the cranked harmonic-oscillator model to gain insights into patterns revealed by the NLF at high angular momentum. Results: In a deformed rotating nucleus, several NLFs can be introduced, depending on the definition of the spin-quantization axis and self-consistent symmetries of the system. The oscillating pattern of the NLF can be explained by a constructive interference between the kinetic-energy and particle densities. The nodal pattern seen in the NLF along the major axis of a rotating nucleus comes from single-particle orbits with large aligned angular momentum. The variation of the NLF along the minor axis is traced back to deformation-aligned orbits. Conclusions: The NLF allows a simple interpretation of the shell structure evolution in the rotating nucleus in terms of the angular-momentum alignment of individual nucleons. We expect that the NLF will be useful for the characterization of other collective modes and time-dependent processes.