Comparative methods have commonly been applied in macroecological research. However, few methods exist to map and analyze phylogenetic variation in geographical space. Here we develop a general analytical framework to partition the phylogenetic and ecological structures of macroecological patterns in geographic space. As an example, we apply the framework to evaluate interspecific patterns of body size geographic variation (Bergmann's rule) in European Carnivora. We model the components of variance attributable to ecological and phylogenetic effects, and to the shared influence of both factors. Spatial patterns in the ecological component are stronger than those in the original body size data. More importantly, the magnitude of intraspecific body size patterns (as measured by the correlation coefficient between body size and latitude) is significantly correlated with the ecological component across species, providing a unified interpretation for Bergmann's rule at multiple levels of biological hierarchy. This approach provides a better understanding of patterns in macroecological traits and allows improved understanding of their underlying ecological and evolutionary mechanisms.