CITATION:

Glaw, F., Köhler, J., Hawlitschek, O. et al. Extreme miniaturization of a new amniote vertebrate and insights into the evolution of genital size in chameleons. Sci Rep 11, 2522 (2021). https://doi.org/10.1038/s41598-020-80955-1

#This reads the data into R itself
chameleons <- read.csv("chameleons.csv")

#And this converts the species to a factor variable
chameleons$species = as.factor(chameleons$species)
head(chameleons)
##                species    specimenID  SVL HPL RelativeHPL
## 1 Brookesia antakarana  ZSM 225/2004 45.5 3.7         8.1
## 2 Brookesia antakarana  ZSM 234/2004 51.4 4.5         8.8
## 3 Brookesia antakarana  ZSM 226/2004 42.4 4.4        10.4
## 4 Brookesia antakarana ZSM 1661/2012 47.3 4.8        10.1
## 5 Brookesia antakarana ZSM 1664/2012 48.2 5.6        11.6
## 6 Brookesia antakarana  ZSM 153/2018 45.6 4.7        10.3
#This scatterplot shows the correlation between chameleon body size and (proportionate) hemipenes length. 
plot(chameleons$SVL, chameleons$RelativeHPL,
     xlab="Snout-to-vent length (mm)",
     ylab="Hemipenes Length (% of SVL)",
     main="Chameleon Size vs. Proportionate Hemipenes Length",
     pch=21,
     col="black",
     bg="hotpink"
)

#This draws a linear regression line. Why? There are too many datapoints for `type="b"` to produce anything useful. It just looks like a stack of needles :(

regLine <- lm(RelativeHPL ~ SVL, data=chameleons)
abline(regLine)
grid()

hist(
  chameleons$RelativeHPL,
  col="hotpink",
  main="Relative Hempienes Length",
  xlab="Hemipenes Proportionate Length (% of SVL)",
)

grid()