{"id":13401083,"url":"https://github.com/mkearney/hexagon","last_synced_at":"2025-04-12T10:51:12.113Z","repository":{"id":124078525,"uuid":"128805927","full_name":"mkearney/hexagon","owner":"mkearney","description":"◀️⏹▶️ R package for creating hexagon shaped xy data frames.","archived":false,"fork":false,"pushed_at":"2019-01-17T08:05:27.000Z","size":697,"stargazers_count":41,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-07-31T19:28:32.405Z","etag":null,"topics":["hex-sticker","hexagon","hexbin","hexo","hexsticker","mkearney-r-package","r-package","r-packages","rstats","stickers"],"latest_commit_sha":null,"homepage":"","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/mkearney.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-04-09T16:59:15.000Z","updated_at":"2024-01-29T05:06:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef9ba128-e4c9-4d19-909d-8eb852328c79","html_url":"https://github.com/mkearney/hexagon","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/mkearney%2Fhexagon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Fhexagon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Fhexagon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkearney%2Fhexagon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkearney","download_url":"https://codeload.github.com/mkearney/hexagon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557844,"owners_count":21124165,"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":["hex-sticker","hexagon","hexbin","hexo","hexsticker","mkearney-r-package","r-package","r-packages","rstats","stickers"],"created_at":"2024-07-30T19:00:58.516Z","updated_at":"2025-04-12T10:51:12.093Z","avatar_url":"https://github.com/mkearney.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n# hexagon \u003cimg src=\"man/figures/logo.png\" width=\"160px\" align=\"right\" /\u003e \n\n\u003c!-- [![Build Status](https://travis-ci.org/mkearney/hexagon.svg?branch=master)](https://travis-ci.org/mkearney/hexagon)\n[![CRAN status](https://www.r-pkg.org/badges/version/rtweet)](https://cran.r-project.org/package=hexagon)\n[![Coverage Status](https://codecov.io/gh/mkearney/hexagon/branch/master/graph/badge.svg)](https://codecov.io/gh/mkearney/hexagon?branch=master)\n\n![Downloads](https://cranlogs.r-pkg.org/badges/hexagon)\n![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/hexagon) --\u003e\n[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\nR package for creating hexagon shaped xy data frames.\n\n## Installation\n\nTo get the current development version from Github:\n\n```{r, eval=FALSE}\n## install devtools package if it's not already\nif (!requireNamespace(\"devtools\", quietly = TRUE)) {\n  install.packages(\"devtools\")\n}\n\n## install dev version of hexagon from github\ndevtools::install_github(\"mkearney/hexagon\")\n\n## load rtweet package\nlibrary(hexagon)\n```\n\n## Usage\n\n```{r, eval=FALSE}\n## create hexagon xy data frame using argument defaults\nhex1 \u003c- hexdf()\n\n## plot outline of hexagon\nwith(hex1, plot(x, y, type = \"l\"))\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"tools/readme/plot1.png\" \u003e \u003c/p\n\n\u0026nbsp;\n\n```{r, eval=FALSE}\n## create larger hexagon to the lower right with a different midpoint\nhex2 \u003c- hexdf(2, mid = c(2.5, -2))\n\n## load ggplot2\nlibrary(ggplot2)\n\n## plot both hex1 and hex2 objects using ggplot2\nggplot(hex1, aes(x, y)) +\n  geom_polygon(fill = \"blue\") +\n  geom_polygon(data = hex2, fill = \"red\")\n```\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"tools/readme/plot2.png\" \u003e \u003c/p\n\n\u0026nbsp;\n\n### Example\n\nCreate a package sticker\n\n```{r fig.height=2.0, fig.width=1.73, eval=FALSE}\n## generate some data to plot\nn \u003c- 43\nden \u003c- ceiling(n / 5)\nx \u003c- seq(-.525, .465, length.out = n) + rep(c(-.005, .005), ceiling(n/2))[1:n]\ny \u003c- seq(-.1, .1, length.out = ceiling(n / den))\ny \u003c- rep(c(y, rev(y)), ceiling(n / den))[1:n] + seq(.0, .45, length.out = n)\nz \u003c- c(rep(\"a\", ceiling(n / den)), rep(\"b\", ceiling(n / den)))\nz \u003c- rep(z, ceiling(n / den))[1:n]\npts \u003c- data.frame(x, y, z)\n\n## create base plot\np_ \u003c- ggplot(hex1, aes(x, y)) +\n  geom_polygon(fill = \"#114466\", colour = \"#001030\", size = 1) +\n  geom_point(data = pts, aes(fill = z, colour = z), shape = 21, size = 1.75) +\n  scale_fill_manual(values = c(\"#8CFF00\", \"#cc00ff\")) +\n  scale_colour_manual(values = c(\"#0A2200\", \"#110033\")) +\n  annotate(\"text\", 0, -.36, label = \"hexagon\",\n    colour = \"white\", size = 8, fontface = \"bold\") +\n  coord_fixed(ratio = 1, expand = TRUE) +\n  coord_cartesian(xlim = range(hex1$x), ylim = range(hex1$y)) +\n  theme_void()\n\n## adjust margin to maximize sticker\nt \u003c- 6\nr \u003c- 5\nb \u003c- 9\nl \u003c- 8\np \u003c- p_ +\n  theme(legend.position = \"none\",\n    plot.margin = margin(-t, -r, -b, -l, unit = \"pt\"))\n\n#view plot in device\np\n\n## save plot with sticker dimensions\n#ggsave(\"hexagon-logo.png\", p, width = 1.73, height = 2,\n#  units = \"in\", bg = \"transparent\")\n```\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"150px\" src=\"tools/readme/dots-sticker.png\" \u003e \u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkearney%2Fhexagon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkearney%2Fhexagon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkearney%2Fhexagon/lists"}