{"id":13423692,"url":"https://github.com/r-lib/isoband","last_synced_at":"2025-07-11T18:37:30.347Z","repository":{"id":47249228,"uuid":"163481406","full_name":"r-lib/isoband","owner":"r-lib","description":"isoband: An R package to generate contour lines and polygons.","archived":false,"fork":false,"pushed_at":"2024-07-09T13:16:25.000Z","size":38452,"stargazers_count":132,"open_issues_count":9,"forks_count":15,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-07T07:50:03.403Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://isoband.r-lib.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-29T06:05:34.000Z","updated_at":"2025-06-27T07:12:38.000Z","dependencies_parsed_at":"2024-12-28T20:08:36.300Z","dependency_job_id":"7df98595-fcc3-4d08-b893-3390a9c632df","html_url":"https://github.com/r-lib/isoband","commit_stats":null,"previous_names":["wilkelab/isoband"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/r-lib/isoband","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fisoband","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fisoband/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fisoband/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fisoband/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/isoband/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fisoband/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264872702,"owners_count":23676705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:00:40.775Z","updated_at":"2025-07-11T18:37:30.301Z","avatar_url":"https://github.com/r-lib.png","language":"C++","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  dpi = 150\n)\n```\n\n# isoband \u003cimg width=\"120\" alt=\"\" align=\"right\" src=\"man/figures/logo.png\"\u003e\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/isoband)](https://CRAN.R-project.org/package=isoband)\n[![R-CMD-check](https://github.com/r-lib/isoband/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/isoband/actions/workflows/R-CMD-check.yaml)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/isoband/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/isoband?branch=main)\n\u003c!-- badges: end --\u003e\n\nGenerate contour lines (isolines) and contour polygons (isobands) from regularly spaced grids containing elevation data. Package originally written by Claus Wilke and donated to r-lib in 2022.\n  \n## Installation\n\nInstall the latest official release from CRAN via:\n``` r\ninstall.packages(\"isoband\")\n```\n\nInstall the current development from github via:\n``` r\n# install.packages(\"pak\")\npak::pak(\"r-lib/isoband\")\n```\n\n## Examples\n\nThe two main workhorses of the package are the functions `isolines()` and `isobands()`, respectively. They return a list of isolines/isobands for each isolevel specified. Each isoline/isoband consists of vectors of x and y coordinates, as well as a vector of ids specifying which sets of coordinates should be connected. This format can be handed directly to `grid.polyline()`/`grid.path()` for drawing. However, we can also convert the output to spatial features and draw with ggplot2 (see below).\n\n```{r basic-example}\nlibrary(isoband)\n\nm \u003c- matrix(c(0, 0, 0, 0, 0,\n              0, 1, 2, 1, 0,\n              0, 1, 2, 0, 0,\n              0, 1, 0, 1, 0,\n              0, 0, 0, 0, 0), 5, 5, byrow = TRUE)\n\nisolines(1:ncol(m), 1:nrow(m), m, 0.5)\n\nisobands(1:ncol(m), 1:nrow(m), m, 0.5, 1.5)\n```\n\nThe function `plot_iso()` is a convenience function for debugging and testing.\n```{r basic-example-plot, fig.asp = 1, out.width = \"50%\"}\nplot_iso(m, 0.5, 1.5)\n```\n\nThe isolining and isobanding algorithms have no problem with larger datasets. Let’s calculate isolines and isobands for the volcano dataset, convert to sf, and plot with ggplot2.\n\n```{r volcano, fig.asp = 1, out.width = \"50%\"}\nlibrary(ggplot2)\nsuppressWarnings(library(sf))\n\nm \u003c- volcano\nb \u003c- isobands((1:ncol(m))/(ncol(m)+1), (nrow(m):1)/(nrow(m)+1), m, 10*(9:19), 10*(10:20))\nl \u003c- isolines((1:ncol(m))/(ncol(m)+1), (nrow(m):1)/(nrow(m)+1), m, 10*(10:19))\n\nbands \u003c- iso_to_sfg(b)\ndata_bands \u003c- st_sf(\n  level = 1:length(bands),\n  geometry = st_sfc(bands)\n)\nlines \u003c- iso_to_sfg(l)\ndata_lines \u003c- st_sf(\n  level = 2:(length(lines)+1),\n  geometry = st_sfc(lines)\n)\n\nggplot() +\n  geom_sf(data = data_bands, aes(fill = level), color = NA, alpha = 0.7) +\n  geom_sf(data = data_lines, color = \"black\") +\n  scale_fill_viridis_c(guide = \"none\") +\n  coord_sf(expand = FALSE)\n```\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fisoband","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fisoband","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fisoband/lists"}