a, Schematics of the setup. b, Time-projection of a zebrafish larva performing rheotaxis in the dark. Light blue arrows represent flow direction. c, Cross-sectional view of the trial shown in (b). d-e, Behavioral features of the trial shown in (b-c). Light blue indicates water flow stimulus is on. d, Fish orientation in relation to water flow. e, Fish position in the axis of the water flow from the observer’s (black trace) and the fish’s (grey trace) point of view. Blue trace corresponds to the displacement of the water column. f-i, Rheotaxis in the presence and absence of visual cues. f, Polar plot of fish orientation in the axis of the flow during stimulation. Light blue arrow represents flow direction. g, Cosine of the mean orientation (see Methods) for fish presented with different actuator velocities. h, Fish position (from the observer’s point of view) in the axis of the water flow. i, gain (see Methods) for fish presented with different actuator velocities. n = 6 fish subjected to 12 trials at each actuator velocity (288 trials total). Data is shown as means ± s.e.m. ns = p>0.05; * = p>0.01&<0.05; Monte Carlo permutation test.