Binary presence-absence matrices (rows species, columns sites) are often used to quantify patterns of species co-occurrence, and to infer possible biotic interactions from these patterns. Previous classifications of co-occurrence patterns as nested, segregated, or modular have led to contradictory results and conclusions. These analyses usually do not incorporate the functional traits of the species or the environmental characteristics of the sites, even though the outcomes of species interactions often depend on trait expression and site quality. Here we address this shortcoming by developing a method that incorporates realized functional and environmental niches, and relates them to species co-occurrence patterns. These niches are defined from n-dimensional ellipsoids, and calculated from the n eigenvectors and eigenvalues of the variancecovariance matrix of measured environmental or trait variables. Average niche overlap among species and the spatial distribution of niches define a triangle plot with vertices of species segregation (low niche overlap), nestedness (high niche overlap), and modular co-occurrence (clusters of overlapping niches). Applying this framework to temperate understorey plant communities in southwest Poland, we found a consistent modular structure of species occurrences, a pattern not detected by conventional presence-absence analysis. These results suggest that, in our case study, habitat filtering is the most important process structuring understorey plant communities. Furthermore, they demonstrate how incorporating trait and environmental data into co-occurrence analysis improves pattern detection and provides a stronger theoretical framework for understanding community structure.