Introduction

Reefs are among the most diverse and biologically productive environments on Earth (Sargent and Austin 1949, 1954; Odum and Odum 1955; Kohn and Helfrich 1957; Connell 1978; Hatcher 1988; Ferreira et al. 2001; Steneck et al. 2002; Monismith 2007). Despite representing only a small percentage of total oceanic surface area, reefs are home to a disproportionately large fraction of marine species (Spalding and Grenfell 1997; Spalding et al. 2001; Roberts et al. 2002; Spalding and Brown 2015). Among fishes, an estimated 4000 to 8000 species (i.e., ~ 22–44% of marine fishes) are associated with coral and temperate reef habitats (Roberts and Ormond 1987; Choat and Bellwood 1991; Spalding et al. 2001; Aguilar-Medrano and Arias-González 2018). One of the reasons reefs can support such diverse communities is that they are structurally heterogeneous and generally far more complex than other marine habitats (Emery 1978; Choat and Bellwood 1991; Sale 1991; Spalding et al. 2001; Gratwicke and Speight 2005a, b; Lingo and Szedlmayer 2006). These characteristics increase the number of available ecological niches as well as overall productivity (Talbot 1965; Risk 1972; Luckhurst and Luckhurst 1978; Bellwood and Wainwright 2002; Alfaro et al. 2007). Consequently, reefs can support both ecologically and functionally diverse fish communities (Gratwicke and Speight 2005a; Farré et al. 2015; Aguilar-Medrano and Arias-González 2018; Evans et al. 2019).

Habitat structural complexity can also have major implications for fish morphology by influencing the direction and/or the magnitude of evolutionary change. Complex habitats, such as coral and temperate reefs, contain numerous physical obstacles that fishes must avoid or use to their advantage and are therefore predicted to select for morphologies that improve maneuverability, i.e., unsteady swimming (Webb 1994; Blake 2004; Langerhans and Reznick 2010). Structurally simpler habitats, for example the pelagic zone where obstacles and refuges from predators are limited, are expected instead to select for morphologies that improve energy-efficient swimming over long distances, i.e., steady swimming (Webb 1994; Blake 2004; Langerhans and Reznick 2010). It has been argued that there are trade-offs related to body shape associated with increasing performance for either steady or unsteady swimming (Webb 1982; Blake 1983; Webb 1994; Langerhans 2009; Domenici 2010; Langerhans and Reznick 2010). Hydromechanical models predict that steady swimming is facilitated by a fusiform or streamlined body shape and a narrow caudal peduncle, as these characteristics help to minimize energy loss from drag (Breder 1926; Keast and Webb 1966; Webb 1984; Webb and Weihs 1986; Blake et al. 1995; Walker 1997; Blake 2004; Langerhans 2009; Langerhans and Reznick 2010). Conversely, unsteady swimming performance can be improved by deeper, laterally compressed bodies and deeper caudal peduncles, traits that are thought to facilitate sharp turns and rapid acceleration (Alexander 1967; Webb 1984; Webb and Weihs 1986; Webb et al. 1996; Walker 1997; Schrank et al. 1999; Langerhans 2009). In structurally complex reefs, lateral compression may also facilitate predator evasion by allowing fishes to seek refuge in narrow spaces created between rocks or corals (Hixon and Beets 1993; Walker 2000; Lingo and Szedlmayer 2006).

The predictions concerning body shapes that improve performance and fitness in simple versus complex habitats have become pervasive in the fish biology literature and are cited in ichthyology textbooks as a classic example of how habitat affects body shape (e.g., Moyle and Cech 2004; Helfman et al. 2009). These predictions have so far been well supported both by interspecific comparisons of swimming kinematics within an experimental framework (Webb et al. 1996; Schrank et al. 1999; Webb and Fairchild 2001) and by microevolutionary ecological studies comparing body shapes between populations occupying habitats of differing structural complexity (Ehlinger and Wilson 1988; Walker 1997). Support for some of these predictions has also been shown in species-level comparisons across specific taxonomical groups (Davis and Birdsong 1973; Frédérich et al. 2016). However, it remains to be seen if there is a macroevolutionary signature for these patterns at a very broad taxonomic scale. Additionally, given the exceptional ecological and functional diversity of coral and temperate reef fish communities (Gratwicke and Speight 2005a; Farré et al. 2015; Aguilar-Medrano and Arias-González 2018; Evans et al. 2019), we also expect to find evidence for increased morphological disparity among the reef-associated species (Choat and Bellwood 1991; Claverie and Wainwright 2014). In order to test these hypotheses, we compiled a large morphometric dataset of linear traits measured on teleostean fishes with a sufficient phylogenetic scope to incorporate multiple independent evolutionary transitions between reef and non-reef habitats (Supplementary Figure S1). We then applied phylogenetic comparative methods to compare body and caudal peduncle shapes as well as disparities between reef-associated teleosts (complex habitats) and those occupying other types of habitats (considered as less complex).

Methods

Morphological measurements

For this study, we used a subset of 3322 marine teleosts that are part of a larger morphometric dataset assembled from the Smithsonian National Museum of Natural History preserved fish collections [see Price et al. (2019) for a more comprehensive description of the full dataset]. The subset includes species that can occupy both marine and brackish habitats but excludes those that are found exclusively in brackish salinities. We restricted our analyses to six body and caudal peduncle linear measurements for which we had clear hydromechanical predictions about how they would differ as a function of habitat structural complexity (Table 1). These original variables were also used to calculate six additional composite variables that add information about the overall shape of the body and caudal peduncle (Table 2). Multivariate analyses (e.g., morphological disparity, phylogenetic PCAs in Supplementary Material) were performed only on the original variables as the ratios contain redundant information.

Table 1 Definitions of the original morphological traits measured on preserved specimens of teleostean fishes
Table 2 Definitions of composite variables calculated as ratios of the original morphological traits

We size-standardized the original variables using a modification of the log-shape ratios method (Mosimann 1970; Mosimann and James 1979; Darroch and Mosimann 1985). Briefly, we divided each morphological variable by the geometric mean of three linear measurements indicative of the overall size of our specimens (i.e., standard length, maximum body depth and maximum fish width) and log-transformed the resulting ratios. This method was preferred to using residuals of a phylogenetic regression on standard length for two reasons: (1) it preserves information about evolutionary allometry in the data, and (2) it allows us to conserve standard length as a shape variable instead of using it only as a size proxy. Composite variables were not size-standardized as they are ratios of one or more of the original variables and therefore already account for relative size.

Habitat complexity

To compare body shapes between species occupying complex habitats and those occupying simpler ones, we used a binary coding scheme, as coral and temperate reefs are unquestionably the most structurally complex among aquatic habitats (Emery 1978; Monismith 2007) and detailed quantitative data on habitat structural complexity is non-existent for most species. Therefore, we scored each of the species in our dataset as either reef-associated (i.e., complex habitats, n = 1496) or not (i.e., simpler habitats, n = 1826). Although teleosts living in non-reef habitats may experience a wide variety of structural complexities, these are unlikely to match the complexity of coral and temperate reefs. Habitat information was extracted from Fishbase (Froese and Pauly 2020) using the species function from the rfishbase package (Boettiger et al. 2012) in R. To ensure data quality, we performed random spot-checks across the dataset, verifying the Fishbase data against other sources, including scientific literature and other online data repositories.

Analyses

The phylogenetic context for all analyses was provided by a tree published by Rabosky et al. (2018), pruned to the species contained in our dataset. Phylogenetic ANOVAs (Garland et al. 1993) and pgls ANOVAs (Freckleton et al. 2002) were performed on both the size-standardized variables and the composite variables to determine whether there were significant differences in body shape between reef-associated and non-reef teleosts. The phylogenetic and pgls ANOVAs were implemented using the R packages geiger (Pennell et al. 2014) and caper (Orme et al. 2018), respectively. For the phylogenetic ANOVAs sensu Garland et al. (1993), the statistical significance of the F value was determined by generating a null distribution based on 1000 simulations of the dependent variable on the phylogenetic tree under a Brownian motion model of evolution.

Although our hypotheses explicitly predict differences in body shapes across habitats and not differences in body size, we also ran the ANOVAs on the log-transformed geometric mean to see if reef-associated and non-reef species differed in overall size. Moreover, we looked for differences in allometric trajectories between reef-associated and non-reef teleosts. Given that we predicted that reef and non-reef habitats would select for specific body shape characteristics, we tested for differences in allometric trajectories within an adaptive framework. For this purpose, we used the method implemented in the R package slouch (Kopperud et al. 2020) that can be used to determine whether traits under differing selective regimes are evolving toward different primary optima (Hansen et al. 2008). For each of the morphological traits, we compared the fit of four models: (1) a grand mean (or intercept-only) model including only the dependent variable, (2) a more complex grand mean model estimating separate intercepts for the reef-associated and non-reef taxa, (3) a regression model of the dependent variable as a function of size and (4) a regression model that estimates separate coefficients for the reef-associated and non-reef taxa. In the regression models, the primary optimum is modeled as a linear function between the trait of interest and size. The fit of each of the models can be compared using the Akaike information criterion (AICc) modified for small sample sizes (Hurvich and Tsai 1989; Burnham and Anderson 2004). These models allow us to determine whether the trait is approaching an optimum and how fast it is doing so, as well as the proportion of variation in the trait that can be explained by adaptation toward that optimum. The rate at which the trait value approaches the optimum is obtained by interpreting the phylogenetic half-life, which is defined as the “time it takes for the expected trait value to move half the distance from the ancestral state to the primary optimum” (Hansen 1997; Hansen et al. 2008). The half-life is interpreted relative to the length of the phylogeny: a relatively short phylogenetic half-life implies rapid adaptation toward the primary optimum, whereas a longer half-life implies a persistence of the ancestral influence (a half-life of infinity corresponds to Brownian motion) (Hansen et al. 2008). The regression models also include estimated slopes for both an optimal regression and an evolutionary regression. The optimal regression can be interpreted as the expected relationship between shape variables and size in the absence of constraints on the evolution of the traits toward their respective optima. The evolutionary regression is the observed relationship between the shape variables and size and is expected to have a shallower slope compared to the optimal regression if there is a lag in adaptation. The comparisons of allometric trajectories were performed on the log-transformed original variables prior to size standardization.

Finally, to test for differences in morphological disparities between reef-associated and non-reef teleosts, we estimated and compared group-wise disparities using the morphol.disparity function in geomorph (Adams et al. 2020). Briefly, the function calculates disparity as the sum of the diagonal elements from the group covariance matrix scaled by the number of observations in each group (Zelditch et al. 2012). Disparity was estimated first on the log-transformed original variables and then on the log-shape ratios (size-standardized variables).

Results

The results of phylogenetic ANOVAs (sensu Garland et al. 1993) on the original size-standardized variables indicate significant differences between reef-associated and non-reef teleostean fishes in standard length, maximum body depth, head depth and minimum caudal peduncle depth and width (Table 3; Fig. 1). Reef-associated species were found to be less elongate than non-reef species, to have deeper bodies and heads, and to possess both deeper and wider caudal peduncles. We did not find a significant difference in maximum fish width between reef-associated and non-reef species. Similar results were obtained for the composite variables (Table 3, Fig. 2): we found significant differences between reef-associated and non-reef teleosts in fineness and depth-to-width ratios. Reef-associated species have, on average, lower fineness ratios and greater depth-to-width ratios than non-reef species. We did not find significant differences in caudal peduncle compression index or in either of the two caudal tapering indices between reef-associated and non-reef teleosts. We focus here on the results from the Garland et al. (1993) method because the phylogenetic structure of habitat transitions within teleosts (see Supplementary Fig. S1) indicates that taking into account the phylogenetic pattern of the discrete trait may also remove much of the ecological signal as well (i.e., we expect adaptation toward phylogenetically structured optima). The results from the pgls ANOVAs are available in Supplementary Table S5. There were some key differences between these two methods with the pgls ANOVAs uncovering significant differences in maximum fish width and both caudal tapering indices, while significant differences in standard length and fineness ratio between reef-associated and non-reef species were lost.

Table 3 Results of phylogenetic ANOVAs (Garland et al. 1993) on size-standardized original variables and on composite variables as a function of reef-associated and non-reef species
Fig. 1
figure 1

Violin plots showing differences in distribution for the size-standardized shape variables between non-reef (blue) and reef-associated (yellow) fishes. The violin plots are overlain with boxplots that specify the position of the medians, first and third quartiles

Fig. 2
figure 2

Violin plots showing differences in distribution for the composite variables between non-reef (blue) and reef-associated (yellow) fishes. The violin plots are overlain with boxplots that specify the position of the medians, first and third quartiles

The comparison of geometric means between habitats showed no significant difference in overall body size between reef-associated and non-reef teleosts (Table 3). As for differences in allometric trajectories, the results from our analyses using slouch (Table 4) revealed that with the exception of maximum fish width, the models with separate estimates of the regression coefficients for reef-associated and non-reef species were always preferred over those with combined estimates of the parameters, as indicated by their lower AICc values. For maximum fish width, a model with a single estimate of the regression coefficients for reef-associated and non-reef teleosts was equally well supported. The best supported models explained large proportions of the variation with R2 values ranging from 0.62 to 0.89. Compared to the regression models, the intercept-only models explain only a fraction of the variation in the data as demonstrated by their low R2 values. Moreover, the amount of variation explained by the two-intercept models is only slightly larger than that of the single-intercept models and the differences in the estimated intercepts between the reef-associated and non-reef species are quite low. These results indicate that size variation has a strong effect on body shape and that whether a fish lives in a reef or a non-reef habitat has a measurable but negligible impact on this allometric relationship. Furthermore, for all variables, the estimated regression slopes are close to one, which suggests that the impressive variation in body shapes that can be observed among teleostean fishes does not require large deviations from isometry to be produced. Finally, for all of the best-fitting models, the phylogenetic half-lives are far shorter than the depth of the tree, suggesting that all traits are rapidly adapting toward their respective primary optima.

Table 4 Results from regressions of log-transformed original variables on log-size as a function of habitat (n = 3313)

Prior to size standardization, we did not find a significant difference in disparities between the reef-associated and non-reef teleosts. However, the comparison of Procrustes variances estimated from the size-standardized variables revealed that disparities were significantly greater in non-reef species (Table 5).

Table 5 Estimates of multivariate morphological disparities for reef-associated and non-reef species for the original variables

Discussion

Our results reveal clear body shape differences between teleostean lineages inhabiting the structurally complex reefs and those that occupy relatively simpler habitats, which cannot be explained by differences in evolutionary allometry. The directions of the shape differences are consistent with predictions from hydromechanical models of swimming kinematics and observations from micro- and macroevolutionary studies. Contrary to our expectation, we also found that non-reef teleostean fishes are more morphologically disparate than reef-associated ones.

We predicted that across teleostean fishes, performance-based selection for either sustained swimming or greater maneuverability would lead to body shape differences between species associated with complex reef habitats and those living in structurally simpler habitats. We found that, on average, reef-associated species had deeper bodies relative to their overall size and width, which supports our prediction that they should be deeper and more laterally compressed than species in relatively simpler habitats, as these traits are thought to improve accelerating and turning maneuvers (Alexander 1967; Webb 1983, 1994; Domenici 2010). Reef-associated species were also found to have deeper and wider caudal peduncles relative to their size compared to the non-reef species. Thicker caudal peduncles may be advantageous for fast starts in reef environments by contributing to the thrust generated by the caudal fin during quick bursts of acceleration (Webb 1994; Walker 1997; Domenici 2010; Bellwood et al. 2014). In contrast, non-reef teleosts were more elongate, had greater fineness ratios and were not as deep-bodied as the reef-associated species. Furthermore, the caudal peduncles of non-reef teleosts were narrower (width) and shallower (depth) than those of the reef-associated species. These results match our predictions for a more streamlined morphology with a tapering tail in structurally simpler habitats, characteristics which are thought to facilitate steady swimming by maximizing thrust and minimizing energy loss from drag and recoil (Fisher and Hogan 2007; Domenici 2010; Langerhans and Reznick 2010). These shape differences may also be explained in part by the recurrence of elongated morphologies with reduced/tapering tails in deep-sea habitats (e.g., Notacanthiformes, Macrouridae, Ophidiiformes).

Given the results mentioned above, it may seem surprising that neither depth nor width caudal peduncle tapering indices were found to be significantly different between the reef-associated and non-reef teleosts, despite that they are both, on average, lower for the non-reef species. This result could reflect an organismal design constraint: the shape of the caudal peduncle is most likely influenced by the overall shape of the body such that deeper bodied species will also have a relatively deeper caudal peduncle. However, the significant results for the size-standardized minimum caudal peduncle depth and width variables indicate that reef-associated species have a comparatively deeper and wider caudal peduncle relative to their overall size than non-reef species.

Although our predictions based on hydromechanical models were well supported by the data, this is not to say that all sustained swimmers should exhibit a streamlined morphology, nor that high maneuverability can only be achieved with a deep and laterally compressed body shape. Indeed, many of these models are predicated on the assumption that the main thrust producing appendage is the caudal fin. However, fish swimming can be broadly divided in two main categories: (1) body–caudal fin (BCF) swimmers generate thrust using undulations along the body ultimately transmitting force to the caudal fin, and (2) median-paired fin (MPF) swimmers generate thrust using combinations of their other median and paired fins (Alexander 1967; Webb 1975; Webb 1994; Sfakiotakis et al. 1999). Therefore, hydromechanical constraints that apply for BCF swimming kinematics may not always be the same as those that influence MPF swimming kinematics. For example, Walker et al. (2013) found differences in the strength and the direction of the relationship between fineness ratio and endurance swimming performance when comparing BCF and MPF swimmers. Likewise, high maneuverability can be achieved with body shapes other than deep and laterally compressed forms. Many species occupying complex habitats predominantly use MPF swimming gaits (Gerstner 1999; Blake 2004), and Blake (2004) argued that there may be multiple optimal body forms for MPF swimmers. Boxfishes provide one such example where high maneuverability is achieved without a deep and laterally compressed body (Blake 1977; Walker 2000; Bartol et al. 2005). Another way to increase maneuverability is to have a more flexible body (e.g., Fish 2002). Anguilliformes provide a great example of this strategy, as eels are arguably just as efficient as laterally compressed deep-bodied fishes in navigating structurally complex habitats owing to their flexible elongated bodies and reduced lateral appendages (Webb 1994; Pfaff et al. 2016). These alternative strategies may help explain why we did not find a significant decrease in body width in reef teleosts compared to non-reef species. Our results may indicate that a laterally compressed body shape is merely the most prevalent strategy for occupants of complex habitats, despite other strategies also being quite common.

The results from our slouch analyses indicate that allometry is a major source of shape variation across teleostean fishes, as the intercept-only models were a poor fit to the data. For all traits except maximum fish width, the best-fitting model allowed the allometric intercept to vary between reef and non-reef habitats, and the next best-fitting model was a single allometric slope and intercept (ΔAICc: 46–70), which suggests that there is a measurable difference between the evolutionary allometries in reef-associated and non-reef lineages. The phylogenetic half-life estimates for the best-fitting models reveal that while adaptation is not immediate (half-life = 0), it is rapid relative to the depth of the phylogeny, which is again indicative of the strength of the allometric relationship. Similarly, the difference between the optimal and evolutionary regression slopes indicates few constraints on optimal shape evolution, although the evolutionary slope is slightly shallower suggesting some minor lag in adaptation. These results are consistent with the idea that changes in body proportions can provide a path of least resistance for evolutionary change (Marroig and Cheverud 2005; Friedman et al. 2019). However, when we consider the additional variation explained by the two-intercept models compared to the single-intercept ones, the amount is minuscule (< 0.6%) and the estimated intercepts for reef-associated and non-reef fishes are very similar. Therefore, habitat, in the form of either living in a complex reef or a simpler non-reef environment, has an identifiable but negligible impact on evolutionary allometries within marine teleosts. Thus, the strong shape differences we observed between reef-associated and non-reef fishes were not primarily driven by differences in evolutionary allometries.

The comparison of morphological disparity estimates between reef-associated and non-reef teleosts revealed that once shape variation correlated to size was removed from the data, structurally simpler habitats contained greater body shape disparity (Table 5). This finding contradicts our prediction, stemming from several lines of evidence, that the structurally complex reef habitats should provide more axes of niche diversification than the simpler ones (Willis et al. 2005). First, reefs are well known for supporting fish communities that are highly ecologically and functionally diverse (Gratwicke and Speight 2005a; Farré et al. 2015; Aguilar-Medrano and Arias-González 2018; Evans et al. 2019). Second, higher rates of morphological evolution have been recorded for reef-associated species compared to their non-reef counterparts in both the Haemulidae (Price et al. 2013) and the Labridae (Price et al. 2011), two families that are prevalent in reef environments [although see Frédérich et al. (2016) who found higher phenotypic rates and disparities in non-reef Carangoidei]. Finally, MPF swimming is thought to be more common in structurally complex habitats (Gerstner 1999), and one might expect higher disparities among the MPF swimmers compared to the BCF swimmers. This is because most MPF swimmers rely on the caudal fin at faster gaits (i.e., steady swimming) but primarily use combinations of their other median and paired fins at slower gaits (i.e., unsteady swimming) (Webb 1994; Blake 2004). This can facilitate a decoupling between the body regions that are engaged at faster versus slower gaits, leading to a greater number of possibilities to simultaneously optimize morphology for these specific gaits (Blake et al. 1995; Blake 2004). Higher disparities in the non-reef species may be explained by the fact that in our binary scoring of habitats, the “structurally simpler” category incorporates several different types of habitats (e.g., benthic, pelagic, deep-sea) that may each involve additional selective pressures. Additionally, differences in disparities could also be explained by the greater amount of time that has been spent outside of reef environments during the evolutionary history of teleosts. Indeed, results from stochastic character mapping suggest that teleosts have spent, on average, 16% more time outside of reef habitats during their evolutionary history, thus providing increased opportunity for non-reef lineages to accumulate morphological disparity (Supplementary Material).

Our results support predictions based on long-standing hydromechanical models. However, the R2 values obtained from the phylogenetic ANOVAs indicate that habitat complexity is by no means the only factor that explains variation in size-standardized body shape across marine teleostean fishes, and thus, some caution is necessary when interpreting these results. For several reasons, it is perhaps not too surprising that the amount of variation explained only by differences in habitat complexity is somewhat low. We are examining evolutionary patterns across more than 3000 species, and many other factors are known to influence fish body shape [e.g., trophic ecology (Keast and Webb 1966; Lavin and McPhail 1985; Bellwood et al. 2006; Clabaut et al. 2007), predation pressure (Lavin and McPhail 1985; Brönmark and Miner 1992; Langerhans et al. 2004; Domenici et al. 2008; Langerhans 2009; Price et al. 2015), depth (Zimmerman et al. 2006; Clabaut et al. 2007), water flow (Langerhans et al. 2003; McGuigan et al. 2003; Kerfoot and Schaefer 2006; Leal et al. 2011)]. Moreover, due to the lack of quantitative data on structural complexity, we were only able to compare species with two very broadly defined habitat categories. We also did not distinguish between BCF and MPF swimmers in our analyses, and fishes that use these different forms of locomotion may show different pattern strengths between shape and swimming performance (Walker et al. 2013). Finally, we have focused largely on body shapes, yet fin traits are also important factors in swimming kinematics (Weihs 1989; Gerstner 1999; Fulton et al. 2001; Colgate and Lynch 2004; Bartol et al. 2005). Despite these caveats, the strong support for our predictions concerning the specific body shapes expected to increase swimming performance in complex versus less complex environments provides evidence that habitat complexity has driven divergent body shape evolution in reef-associated and non-reef marine teleosts. Our results therefore confirm reef habitats have made an important contribution to shaping and maintaining present-day patterns of teleostean morphological diversity (Bellwood et al. 2015).