https://github.com/biodivhealth/bivariate_maps
This is a simple but flexible toolkit for visualizing spatial bivariate relationships
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Repository
This is a simple but flexible toolkit for visualizing spatial bivariate relationships
Basic Info
- Host: GitHub
- Owner: BioDivHealth
- Language: R
- Default Branch: main
- Size: 36.1 KB
Statistics
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
🌐 BiVariate_Maps
This repository provides a set of flexible and simple R functions to generate bivariate raster and polygon maps using custom color palettes. Designed with ecological modeling and spatial analysis in mind, the toolkit enables users to explore and visualize spatial covariation between two continuous variables.
🚀 Features
BiColor(): Generate a perceptually blended bivariate color scale using two user-defined gradients and a neutral center.VarClass(): Classify continuous raster or vector values into quantile-based discrete classes.biRaster(): Combine twoSpatRasterlayers into a three-band bivariate map, encoding their spatial relationship into RGB color combinations.biPol(): Assign bivariate colors to polygon features (sf) based on attribute values, ideal for choropleth-style displays.biLegend(): Render a clean, intuitive color legend showing directional strength of each variable and their interaction.
🧭 Applications
These tools are well-suited for:
- Visualizing habitat suitability surfaces
- Mapping joint patterns of biodiversity and environmental gradients
- Communicating spatial overlap of two phenomena in conservation planning, land management, or epidemiology
:exclamation: Requirements
Most of the code relies on basic base-R functionality for processing and handling colour and spatial data. However, it is necessary to install the terra and sf libraries for the raster processing and spatial representation.
:computer: Code access
The main functions can be downloaded directly from this repository alongside the working example, or using the following script:
```{r}
0. Load/install the needed packages
list.of.packages<-c("httr","tidyverse")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[,"Package"])] if(length(new.packages)) install.packages(new.packages)
lapply(list.of.packages,require,character.only=TRUE) # conflicts_prefer(dplyr::filter) rm(list.of.packages,new.packages)
1. Connect to the AutoMaxent GitHub repository
github <- "https://api.github.com/repos/BioDivHealth/BiVariateMaps/git/trees/main?recursive=1" MaxRepo <- GET(git_hub) # Extract the repo information MaxRepo
2. Get the route to the functions
filepath <- data.frame(unlist(lapply(content(MaxRepo)$tree, function(x) x$path))) colnames(filepath) = c('Path') head(file_path)
Extract routes
filepath <- filepath %>% separate(Path,c('folder','filename'),'/') %>% filter(folder == 'Functions') %>% filter(str_detect(filename,'.R'))
3. Configure the routes, download, and export scripts
rawroute <- "https://raw.githubusercontent.com/BioDivHealth/BiVariateMaps/refs/heads/main" #This is the raw route to the gitHub repository MyRoute <- paste(getwd(),"BiVariate_Maps",sep="/")
for(i in 1:nrow(filepath)){ writelines(content(GET(paste(rawroute,filepath$folder[i],filepath$filename[i],sep="/"))), paste(MyRoute,filepath$filename[i],sep="/")) }
4. Load the functions
functions <- MyRoute %>% list.files(recursive = FALSE,pattern = ".R$",full.names = TRUE)
lapply(functions,function(x) source(x))
``
In this case, you would need to specify the working environment or working directory before running the code. The **BiVariate_Maps** functions will be stored in theBiVariate_Mapsfolder created in your working environment. Be aware that this script would also install thehttrandtidyverselibraries on your computer unless you modify the code to use onlyhttr`.
:mag_right: Some output examples
All the figures are generated by the Example.R script using open-sourced data.
Created with ❤️ and spatial insight.
Owner
- Name: Biodiversity and Health
- Login: BioDivHealth
- Kind: organization
- Repositories: 1
- Profile: https://github.com/BioDivHealth
GitHub Events
Total
- Push event: 3
- Create event: 2
Last Year
- Push event: 3
- Create event: 2