{"id":13857944,"url":"https://github.com/hrbrmstr/worldtilegrid","last_synced_at":"2025-03-21T12:30:53.564Z","repository":{"id":141239018,"uuid":"146133298","full_name":"hrbrmstr/worldtilegrid","owner":"hrbrmstr","description":"🔲🗺 World Tile Grid Geom for ggplot2 [WIP]","archived":false,"fork":false,"pushed_at":"2019-07-17T10:48:58.000Z","size":1357,"stargazers_count":44,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T06:09:41.054Z","etag":null,"topics":["cartogram","r","rstats","tile-grid","world-tile-grid"],"latest_commit_sha":null,"homepage":null,"language":"R","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/hrbrmstr.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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}},"created_at":"2018-08-25T22:16:50.000Z","updated_at":"2024-11-14T05:28:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e4c267d-c908-4b8b-8e8e-e71185538e3b","html_url":"https://github.com/hrbrmstr/worldtilegrid","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/hrbrmstr%2Fworldtilegrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fworldtilegrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fworldtilegrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrbrmstr%2Fworldtilegrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrbrmstr","download_url":"https://codeload.github.com/hrbrmstr/worldtilegrid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244135909,"owners_count":20403798,"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":["cartogram","r","rstats","tile-grid","world-tile-grid"],"created_at":"2024-08-05T03:01:51.439Z","updated_at":"2025-03-21T12:30:52.226Z","avatar_url":"https://github.com/hrbrmstr.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: rmarkdown::github_document\neditor_options: \n  chunk_output_type: console\n---\n```{r pkg-knitr-opts, include=FALSE}\nknitr::opts_chunk$set(\n  collapse=TRUE, fig.retina=2, message=FALSE, warning=FALSE,\n  fig.path = \"man/figures/README-\"\n)\noptions(width=120)\n```\n\n[![Travis-CI Build Status](https://travis-ci.org/hrbrmstr/worldtilegrid.svg?branch=master)](https://travis-ci.org/hrbrmstr/worldtilegrid) \n[![Coverage Status](https://codecov.io/gh/hrbrmstr/worldtilegrid/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/worldtilegrid)\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/worldtilegrid)](https://cran.r-project.org/package=worldtilegrid)\n\n# worldtilegrid\n\nA ggplot2 Geom for World Tile Grids\n\n## Description\n\nA \"tile grid map\" is a cartogram that uses same-sized tiles in approximate, relative positions of each other to represent a world map. The world tile grid relative position reference system used by this 'ggplot2' 'Geom/Stat' was the original work of 'Jon Schwabish' and converted to 'CSV' by 'Maarten Lambrechts'.\n\n- Ref: \u003chttps://policyviz.com/2017/10/12/the-world-tile-grid-map/\u003e\n- Ref: \u003chttp://www.maartenlambrechts.com/2017/10/22/tutorial-a-worldtilegrid-with-ggplot2.html\u003e\n\n## What's Inside The Tin\n\nThe following functions are implemented:\n\n```{r ingredients, results='asis', echo=FALSE, cache=FALSE}\nhrbrpkghelpr::describe_ingredients()\n```\n\nThe following _data_ is included/exported:\n\n`wtg`:\tWorld Tile Grid Basemap Data\n\n## Installation\n\n```{r install-ex, results='asis', echo = FALSE}\nhrbrpkghelpr::install_block()\n```\n\n## Usage\n\n```{r message=FALSE, warning=FALSE, error=FALSE}\nlibrary(worldtilegrid)\nlibrary(tidyverse)\n\n# current verison\npackageVersion(\"worldtilegrid\")\n\n```\n\n### Example (All countries are in the data set)\n\n```{r message=FALSE, warning=FALSE, error=FALSE, fig.width=8, fig.height=8, fig.retina=2}\niso3cs \u003c- worldtilegrid::wtg$alpha.3\n\nset.seed(1)\ndata_frame(\n  ctry = iso3cs,\n  `Thing Val` = sample(1000, length(ctry))\n) -\u003e xdf\n\nggplot(xdf, aes(country = ctry, fill = `Thing Val`)) +\n  geom_wtg(border_size = 0.5, border_col = \"#252a32\") +\n  geom_text(\n    aes(\n      label = stat(alpha.2), \n      colour = I(ifelse(`Thing Val` \u003c 500, \"white\", \"black\"))\n    ), \n    stat = \"wtg\", size = 2\n  ) + \n  coord_equal() +\n  viridis::scale_fill_viridis() +\n  labs(title = \"World Tile Grid\") +\n  hrbrthemes::theme_ft_rc() +\n  theme_enhance_wtg()\n```\n\n### Example (Only a few countries are in the data set)\n\n```{r message=FALSE, warning=FALSE, error=FALSE, fig.width=8, fig.height=8, fig.retina=2}\nset.seed(1)\ndata_frame(\n  ctry = worldtilegrid::wtg$alpha.3[1:30],\n  `Thing Val` = sample(1000, length(ctry))\n) -\u003e xdf\n\nggplot(xdf, aes(country = ctry, fill = `Thing Val`)) +\n  geom_wtg() +\n  geom_text(\n    aes(\n      label = stat(alpha.2),\n      colour = I(ifelse(`Thing Val` \u003c 400, \"#b2b2b2\", \"#2b2b2b\"))\n    ), \n    stat=\"wtg\", size=2\n  ) + \n  coord_equal() +\n  viridis::scale_fill_viridis() +\n  labs(title = \"World Tile Grid\") +\n  hrbrthemes::theme_ft_rc() +\n  theme_enhance_wtg()\n```\n\n### Facet Example (All countries are in the data set)\n\n```{r message=FALSE, warning=FALSE, error=FALSE, fig.width=10, fig.height=6, fig.retina=2}\nset.seed(1)\ndata_frame(\n  ctry = worldtilegrid::wtg$alpha.3,\n  `Thing Val` = sample(1000, length(ctry)),\n  grp = 'Thing One'\n) -\u003e xdf1\n\ndata_frame(\n  ctry = worldtilegrid::wtg$alpha.3,\n  `Thing Val` = sample(1000, length(ctry)),\n  grp = 'Thing Two'\n) -\u003e xdf2\n\nbind_rows(\n  xdf1,\n  xdf2\n) -\u003e xdf\n\nggplot(xdf, aes(country = ctry, fill = `Thing Val`)) +\n  geom_wtg() +\n  coord_equal() +\n  facet_wrap(~grp) +\n  viridis::scale_fill_viridis() +\n  labs(title = \"World Tile Grid Facets\") +\n  hrbrthemes::theme_ft_rc() +\n  theme_enhance_wtg()\n```\n\n### Facet Example (Only a few countries are in the data set)\n\nThe geom will fill in the gaps for you:\n\n```{r message=FALSE, warning=FALSE, error=FALSE, fig.width=10, fig.height=6, fig.retina=2}\nset.seed(1)\ntibble(\n  ctry = sample(iso3cs, 40),\n  `Thing Val` = sample(1000, length(ctry)),\n  grp = 'Thing One'\n) -\u003e xdf1\n\ntibble(\n  ctry = sample(iso3cs, 40),\n  `Thing Val` = sample(1000, length(ctry)),\n  grp = 'Thing Two'\n) -\u003e xdf2\n\nbind_rows(\n  xdf1,\n  xdf2\n) -\u003e xdf\n\nggplot(xdf, aes(country = ctry, fill = `Thing Val`)) +\n  geom_wtg(border_size = 0.5) +\n  coord_equal() +\n  facet_wrap(~grp) +\n  scale_fill_viridis_c(\n    na.value = alpha(hrbrthemes::ft_cols$gray, 2/5), direction = -1,\n    option = \"magma\"\n  ) +\n  guides(\n    fill = guide_colourbar(title.position = \"top\", title.hjust = 0.5)\n  ) +\n  labs(title = \"World Tile Grid Facets\") +\n  hrbrthemes::theme_ipsum_rc() +\n  theme_enhance_wtg() +\n  theme(legend.position = \"bottom\") +\n  theme(legend.key.width = unit(2, \"lines\"))\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fworldtilegrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrbrmstr%2Fworldtilegrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrbrmstr%2Fworldtilegrid/lists"}