Artificial neural networks were used to pattern the use and partition of riverbed mesohabitats by four coexisting mayflies (Ephemera danica, Rhithrogena semicolorata, Caenis sp., and Serratella ignita), in a fast-flowing stream. Sixty-six samples were taken from the various mesohabitat types throughout a one-year period. Water depth, current velocity, substratum composition, and particulate organic matter were used to describe the mesohabitats within each sample unit. The species and abiotic data were computed separately with the self-organizing map (SOM) algorithm. Then, using the k-means algorithm, clusters were detected on the maps and the sampling units were classified separately for each variable and for species densities. Four clusters could be identified on the SOM according to nine environmental variables, and this classification was related to the morphodynamic conditions, chiefly with respect to substrate composition and current velocity. Similarly, three subsets were derived from the SOM according to gradients of species densities. The coincidence between 'abiotic' and 'mayfly' clusters showed that: (1) E. danica, Caenis sp. and S. ignita used similar mesohabitats, but E. danica was temporally segregated; (2) competition for space was likely to occur between Caenis sp. and S. ignita; and (3) R. semicolorata was spatially segregated from the three other mayflies. The method is discussed with reference to two alternative techniques: habitat preference curves, and multivariate analyses. The former implies a greater computation effort and is rather convenient under applied perspectives. The second approach faces the basic assumption that non-linear modelling methods should be preferred for dealing with ecological data which vary and covary in non-linear fashions. By combining ordering and clustering abilities (and other advantages such as gradient analysis and detection of outliers), SOM provides a visual and efficient way to bring out structures in the distribution of co-occurring species within multivariate microenvironments.