Distribution maps play a vital role in protecting and managing individual species, as well as identifying biodiversity hotspots and sensitive areas with imperiled species NatureServe. Utilizing remote sensing data, such maps are created to assess land surface cover for various purposes such as resource assessment, land management, and modeling (Aspinall, 2002). Incorporating species occurrence information into these maps is essential for providing spatial context for ecological understanding (Barkowsky & Freksa, 1997). However, this process involves prioritizing criteria due to medium constraints, with choices between uniform or selective adjustments (Hijmans & Elith, 2023). While computer-generated maps typically prioritize uniformity for systematic solutions, selective approaches offer tailored maps to meet specific ecological research needs (Austin, 2002; Barkowsky & Freksa, 1997; Hijmans & Elith, 2011; Sillett et al., 2012).
Keyanswers offers a function that enhances data visualization through maps generated using the etopo 1 model. The code for this function is accessible on the Keyanswers GitHub page, where all arguments are explained along with some basic examples. You can find the function code on the GitHub page of Keyanswers. The following maps have their labels in English, French, Quechua, Basque, Italian, Russian, and Spanish; Simply because I could do it.
Thanks for read, be happy.
d = data.frame(Lon = c(-118 , -108), Lat = c(22.5, 34))
d
## Lon Lat
## 1 -118 22.5
## 2 -108 34.0
QMap(d)
Fig. 1: Basic map obtained from a 2x2 data frame dimension
Here is the data for Farfantepenaeus aztecus obtained from
GBIF using the rgbif package. Later, it was converted into
a data frame, and the column names were explored to select them for
plotting occurrence or abundance values.
require('rgbif')
fpaz = occ_data(scientificName = 'Farfantepenaeus aztecus', limit = 1000)
Dfpaz = data.frame(fpaz$data)
data.frame(colnames(Dfpaz[,1:20]))
## colnames.Dfpaz...1.20..
## 1 key
## 2 scientificName
## 3 decimalLatitude
## 4 decimalLongitude
## 5 issues
## 6 datasetKey
## 7 publishingOrgKey
## 8 installationKey
## 9 hostingOrganizationKey
## 10 publishingCountry
## 11 protocol
## 12 lastCrawled
## 13 lastParsed
## 14 crawlId
## 15 basisOfRecord
## 16 individualCount
## 17 occurrenceStatus
## 18 lifeStage
## 19 taxonKey
## 20 kingdomKey
The result of the above steps is a data frame with three columns (decimalLatitude, decimalLongitude, IndividualCounts), which were reordered and renamed (Latitude, Longitude, Counts). The dimensions of the data frame were checked. Following this, NA records were removed, and the information of each column was reviewed using the summary function.
## Longitude Latitude Counts
## 1 -97.324 27.7074 1
## 2 -97.324 27.7074 1
## 3 -97.324 27.7074 1
## 4 -97.324 27.7074 1
## 5 -97.324 27.7074 1
## 6 -97.324 27.7074 1
## [1] 1000 3
## [1] 164 3
## Longitude Latitude Counts
## Min. :-97.32 Min. :18.35 Min. : 1.00
## 1st Qu.:-91.47 1st Qu.:27.71 1st Qu.: 1.00
## Median :-75.75 Median :36.71 Median : 2.00
## Mean :-80.41 Mean :32.79 Mean : 10.29
## 3rd Qu.:-75.47 3rd Qu.:37.78 3rd Qu.: 6.25
## Max. :-72.30 Max. :40.88 Max. :541.00
In this example the function through the sunits,
vnames, and col1 allow to select the names of
the variable represented in dots on maps, the units for the meters
legend, and the colors of the dots. This map is in French.
QMap(DF, sunits = "Mètres", vnames = expression(paste("Occurrence - ", italic("Farfantepenaeus aztecus"))),col1='orange')
Fig. 2: Occurrence data for Farfantepenaeus aztecus
In the below map the text font was changed using ftext
argument. This map is in Quechua. To present a different map of
Farfantepenaeus aztecus was created a new data frame using a
subset from the original data.
DF2 = DF[(DF$Longitude > -80 & DF$Latitude > 34),]
summary(DF2)
## Longitude Latitude Counts
## Min. :-76.52 Min. :35.19 Min. : 1.00
## 1st Qu.:-75.83 1st Qu.:36.53 1st Qu.: 1.00
## Median :-75.57 Median :37.40 Median : 2.00
## Mean :-75.42 Mean :37.39 Mean : 11.41
## 3rd Qu.:-75.25 3rd Qu.:38.20 3rd Qu.: 7.00
## Max. :-72.30 Max. :40.88 Max. :541.00
QMap(DF2, xlab = "Ñawi", ylab = "Wiraqocha", n = 3, vnames = expression(paste(" K'anchay - ", italic("Farfantepenaeus aztecus"))), col1 = 'yellow', sunits = "Pisqu - Llaqtap'isqu (m)", ftext = "Nirmala UI")
Fig. 3: Abundance data for Farfantepenaeus aztecus
The option to relocate the windrose and barscale is available, such as is presented in this subset.
DF3 = DF[(DF$Longitude > -100 & DF$Longitude < -80) & (DF$Latitude < 35),]
summary(DF3)
## Longitude Latitude Counts
## Min. :-97.32 Min. :18.35 Min. : 1.000
## 1st Qu.:-93.66 1st Qu.:18.49 1st Qu.: 1.000
## Median :-92.57 Median :18.66 Median : 1.000
## Mean :-93.23 Mean :20.99 Mean : 7.413
## 3rd Qu.:-91.70 3rd Qu.:25.48 3rd Qu.: 5.000
## Max. :-91.25 Max. :28.98 Max. :83.000
QMap(DF3, vnames = expression(paste("Aberastasuna - ", italic("Farfantepenaeus aztecus"))), col1 = "orange", n = 3, sunits = "Metros (m)", ftext = "Malgun Gothic" , xlab = "Longitudea", ylab = "Latitudea", Apos = "tr", Bpos = "bl")
Fig. 4: Farfantepenaeus aztecus Abundance in Basque
The records of the green algae Enteromorpha were obtained
from GBIF using the rgbif package. The data was sorted by
deleting all longitude values lower than zero. Consequently, two
records, each with a count of one, were removed. Later, the abundance
values of this genus were plotted.
asd = occ_data(scientificName = 'Enteromorpha', limit = 1000)
Dasd = data.frame(asd$data)
DFs = Dasd[c(4,3,16)]
colnames(DFs) = c("Longitude","Latitude", "Counts")
dim(DFs)
## [1] 1000 3
DFs = na.omit(DFs)
DFs = DFs[DFs$Longitude > 0,]
summary(DFs)
## Longitude Latitude Counts
## Min. : 1.721 Min. :50.76 Min. : 1.000
## 1st Qu.: 7.503 1st Qu.:58.47 1st Qu.: 1.000
## Median : 8.056 Median :62.64 Median : 1.000
## Mean : 9.185 Mean :61.78 Mean : 1.849
## 3rd Qu.: 8.944 3rd Qu.:63.12 3rd Qu.: 1.000
## Max. :19.071 Max. :69.70 Max. :70.000
QMap(df = DFs, xlab = "Longitudine", ylab = "Latitudine", sunits = "Metri (m)", n = 3, col1 = "yellow", Bpos = "br", vnames = expression(paste('Abbondanza -', italic(' Enteromorpha'))))
Fig. 4: Occurence data for Enteromorpha genus
The last example using species distribution data was conducted with information on members of the Bythograea genus. This genus comprises small marine crabs found in hydrothermal vents, distributed in areas such as the southern East Pacific Rise and the Galapagos Rift (Guinot & Hurtado, 2003).
## Longitude Latitude Counts
## 1 -108.85571 23.94162 1
## 2 -108.55900 23.35280 1
## 3 -108.54300 23.35760 2
## 4 -85.91183 -0.76969 1
## 5 -108.52800 23.38030 1
## 6 -108.52800 23.38030 1
## [1] 219 3
QMap(DAc2, vnames = expression("Встречаемость"), col1 = "black", n = 3, sunits = "Метры (m)",
ftext = "Malgun Gothic" , xlab = "Долгота", ylab = "Широта", Apos = "tr", Bpos = "br", angle = 90)
Fig. 5: Ocurrence data for Bythograea genus
The function offers multiple options for quickly generating maps with data. However, it’s crucial to emphasize the importance of carefully positioning station names. The placement of station labels, as required when working with ggplot2, is crucial. Therefore, a bit of preprocessing could enhance the data representation, as demonstrated in the example below.
Dat = data.frame(Lon = runif(40,-17, -5), Lat = runif(40,36, 56))
Dat$Sta = stringi::stri_rand_strings(40,2,'[a-z]')
Dat = Dat[order(-Dat$Lon),]
head(Dat)
## Lon Lat Sta
## 34 -5.669603 48.88529 sh
## 9 -5.830071 37.68831 wk
## 36 -5.858242 50.62612 sy
## 7 -6.474031 40.16144 lv
## 38 -6.780251 47.87269 eh
## 13 -7.563808 37.99459 qq
Dat$var = c()
for(i in 1:40){
if(Dat$Lon[i] < -10 & Dat$Lon[i] > -16.5 & Dat$Lat[i] < 55 & Dat$Lat[i] > 36.2 | Dat$Lat[i] >= 45 & Dat$Lat[i] <= 50.1 & Dat$Lon[i] < -6){
Dat$var[i] = runif(40, 3600, 27000)
} else {
Dat$var[i] = NA
}
}
summary(Dat)
## Lon Lat Sta var
## Min. :-16.865 Min. :36.64 Length:40 Min. : 3951
## 1st Qu.:-13.300 1st Qu.:44.68 Class :character 1st Qu.: 8397
## Median :-11.216 Median :48.45 Mode :character Median :13706
## Mean :-11.067 Mean :47.63 Mean :14225
## 3rd Qu.: -8.928 3rd Qu.:51.84 3rd Qu.:19215
## Max. : -5.670 Max. :55.19 Max. :26020
## NA's :14
QMap(df = Dat, col1 = "yellow", Bpos = "br", n = 4, sta = 3, poy = 0.3, vnames = "Abundancia",sunits = "Metros (m)", xlab = "Longitud", ylab = "Latitud")
Fig. 6: Example to display station labels
In conclusion, while the function offers diverse options for swiftly generating maps, meticulous attention to station label placement is paramount. By prioritizing preprocessing methods, such as those demonstrated in the examples, data representation can be significantly enhanced, ensuring clear and informative visualizations.
Aspinall, R. J. (2002). Use of logistic regression for validation of maps of the spatial distribution of vegetation species derived from high spatial resolution hyperspectral remotely sensed data. Ecological Modelling, 157(2–3), 301–312. https://doi.org/10.1016/S0304-3800(02)00201-6
Austin, M. P. (2002). Spatial prediction of species distribution: An interface between ecological theory and statistical modelling. Ecological Modelling, 157(2–3), 101–118. https://doi.org/10.1016/S0304-3800(02)00205-3
Barkowsky, T., & Freksa, C. (1997). Cognitive requirements on making and interpreting maps. In S. C. Hirtle & A. U. Frank (Eds.), Spatial Information Theory A Theoretical Basis for GIS (Vol. 1329, pp. 347–361). Springer Berlin Heidelberg. https://doi.org/10.1007/3-540-63623-4_60
Bauer, R. (2017). A Plotting Toolbox for 2D Oceanographic Data. Package ‘oceanmap’ (0.0.3) [R language].
Bauer, R. (2020). A Plotting Toolbox for 2D Oceanographic Data. Package ‘oceanmap’ (0.1.1) [R language].
Chang, W. (2016). Tools for using fonts. Package ‘extrafont’ (0.17) [R language].
Guinot, D., & Hurtado, L. A. (2003). Two new species of hydrothermal vent crabs of the genus Bythograea from the southern East Pacific Rise and from the Galapagos Rift (Crustacea Decapoda Brachyura Bythograeidae). Comptes Rendus. Biologies, 326(4), 423–439. https://doi.org/10.1016/S1631-0691(03)00126-4
Deckmyn, A. (2018). Draw Geographical Maps. Package ‘maps’ [R language].
Dunnington, D., Thorne, B., & Hernangómez, D. (2023). Spatial Data Framework for ggplot2, Package ‘ggspatial’ (1.1.9) [R language].
Gerritsen, H. (2018). Data Visualisation on Maps. Package ‘mapplots’ (1.5.1) [R language].
Hijmans, R., & Elith, J. (2011). Species distribution modelling with R (p. 87).
Hijmans, R. J., & Elith, J. (2023). Species Distribution Models.
Pante, E., & Bouhet, B. S. (2015a). Analysing bathymetric data in R with marmap. 20.
Pante, E., & Bouhet, B. S. (2015b). Making and using bathymetric maps in R with [R language].
Pebesma, E., Bivand, R., Racine, E., Sumner, M., Cook, I., Keitt, T., Lovelace, R., Wickham, H., Ooms, J., Müller, K., Lin, T.,
Baston, D., & Dunnington, D. (2023). Simple Features for R, Package ‘sf’ (1.0-15) [R language].
Sillett, T. S., Chandler, R. B., Royle, J. A., Kéry, M., & Morrison, S. A. (2012). Hierarchical distance-sampling models to estimate population size and habitat-specific abundance of an island endemic. Ecological Applications, 22(7), 1997–2006.
Tang, Y. (2023). Data Visualization Tools for Statistical Analysis Results. Package ‘ggfortify’ (0.4.16) [R language].