{"id":18722617,"url":"https://github.com/mdsumner/ggminboundingrect","last_synced_at":"2025-11-11T05:30:21.214Z","repository":{"id":72211487,"uuid":"303298245","full_name":"mdsumner/ggminboundingrect","owner":"mdsumner","description":"Compute the Minimum Bounding Rectangle and Plot with the Grammar of Graphics","archived":false,"fork":false,"pushed_at":"2020-10-12T10:26:32.000Z","size":96,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T12:17:03.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdsumner.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-10-12T06:29:24.000Z","updated_at":"2020-10-12T10:26:34.000Z","dependencies_parsed_at":"2023-02-24T05:30:20.974Z","dependency_job_id":null,"html_url":"https://github.com/mdsumner/ggminboundingrect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fggminboundingrect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fggminboundingrect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fggminboundingrect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdsumner%2Fggminboundingrect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdsumner","download_url":"https://codeload.github.com/mdsumner/ggminboundingrect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239587244,"owners_count":19663892,"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-11-07T13:42:13.172Z","updated_at":"2025-11-11T05:30:21.060Z","avatar_url":"https://github.com/mdsumner.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\r\noutput: github_document\r\neditor_options: \r\n  chunk_output_type: console\r\n---\r\n\r\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\r\n\r\n```{r, include = FALSE}\r\nknitr::opts_chunk$set(\r\n  collapse = TRUE,\r\n  comment = \"#\u003e\",\r\n  fig.path = \"man/figures/README-\",\r\n  out.width = \"100%\"\r\n)\r\n```\r\n\r\n# ggminboundingrect\r\n\r\n\u003c!-- badges: start --\u003e\r\n\u003c!-- badges: end --\u003e\r\n\r\nThe goal of ggminboundingrect is to provide ggplot2 support for minimum bounding rectangle. \r\n\r\n\r\n## Installation\r\n\r\nYou can install ggminboundingrect from [GitHub](https://github.com/mdsumner/ggminboundingrect) with:\r\n\r\n``` r\r\nremotes::install_github(\"mdsumner/ggminboundingrect\")\r\n```\r\n\r\n## Example\r\n\r\nThis is a basic example which shows you how to compute and draw the minimum bounding rectangle with `geom_mbr()`. \r\n\r\n```{r example}\r\nlibrary(ggminboundingrect)\r\n\r\nlibrary(ggplot2)\r\nggplot(data.frame(x = rnorm(500), y = rnorm(500), group = rep(1:50, each = 10)), aes(x, y, group = group))  + geom_mbr()\r\n\r\n```\r\n\r\n\r\n\r\nSome sf examples, by decomposing to data frame (known as 'fortify' in old ggplot2 circles ). \r\n\r\n```{r sf-mbr}\r\n## bounds on the feature\r\nd \u003c- sfheaders::sf_to_df(silicate::inlandwaters)\r\nggplot(d,aes(x, y, group = sfg_id)) + geom_mbr()\r\n\r\n## bounds on the polygon (it is a polygon so has 'polygon_id' but might not so consider 'sfg_id')\r\n## also note that polygon_id is not unique across features\r\nd \u003c- sfheaders::sf_to_df(silicate::inlandwaters)\r\nggplot(d,aes(x, y, group = paste(sfg_id, polygon_id))) + geom_mbr()\r\n\r\n## bounds on the path (it is a polygon so has 'linestr_id' but might not so consider 'sfg_id' or multipoint_id etc)\r\n## also note linestring_id is not unique\r\nd \u003c- sfheaders::sf_to_df(silicate::inlandwaters)\r\nggplot(d,aes(x, y, group = paste(polygon_id, linestring_id))) + geom_mbr()\r\n\r\n```\r\n\r\nUse `stat_mbr()` to avoid the default use of path geom drawing . \r\n\r\n```{r stat}\r\nggplot(d,aes(x, y, group = sfg_id, colour = factor(sfg_id))) + stat_mbr(geom = \"point\") + coord_equal()\r\n\r\n\r\n```\r\n\r\n\r\n## Acknowledgements\r\n\r\nThanks to Thomas Pedersen for the awesome ggplot2-extending guide (https://ggplot2-book.org/spring1.html). \r\n\r\nThanks to Mike FC for inspiration. \r\n\r\n\r\n---\r\n\r\n## Code of Conduct\r\n\r\nPlease note that the ggminboundingrect project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fggminboundingrect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdsumner%2Fggminboundingrect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdsumner%2Fggminboundingrect/lists"}