{"id":20046486,"url":"https://github.com/zachcp/piesonamap","last_synced_at":"2025-10-05T08:09:06.701Z","repository":{"id":146169900,"uuid":"52463424","full_name":"zachcp/piesonamap","owner":"zachcp","description":"draw piecharts on a map with ggplot","archived":false,"fork":false,"pushed_at":"2016-02-26T17:01:49.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-23T22:52:35.639Z","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/zachcp.png","metadata":{"files":{"readme":"Readme.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-24T18:06:33.000Z","updated_at":"2016-02-24T18:09:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"b0060125-0fe5-418c-9a3e-e9205a78c80b","html_url":"https://github.com/zachcp/piesonamap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zachcp/piesonamap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcp%2Fpiesonamap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcp%2Fpiesonamap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcp%2Fpiesonamap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcp%2Fpiesonamap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachcp","download_url":"https://codeload.github.com/zachcp/piesonamap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcp%2Fpiesonamap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278425684,"owners_count":25984745,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-13T11:24:13.519Z","updated_at":"2025-10-05T08:09:06.685Z","avatar_url":"https://github.com/zachcp.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"## piesonamap\n\ndraw piecharts on map\n\n## Inspiration\n\nhttp://stackoverflow.com/questions/10368180/plotting-pie-graphs-on-map-in-ggplot\n\n## Usage\n```r\nlibrary(piesonamap)\ndata(nycounty)\ndata(pops)\n\nlibrary(dplyr)\nlibrary(ggtree)\n\n# Get Centroids of NY counties using the sp package.\ngetLabelPoint \u003c- function(county) {sp::Polygon(county[c('long', 'lat')])@labpt}\ndf \u003c- map_data('county', 'new york')                 # NY region county data\ncentroids \u003c- by(df, df$subregion, getLabelPoint)     # Returns list\ncentroids \u003c- do.call(\"rbind.data.frame\", centroids)  # Convert to Data Frame\nnames(centroids) \u003c- c('long', 'lat')                 # Appropriate Header\ncentroids$region \u003c- rownames(centroids)\n\n# process NY data and merge with centroids\nny %\u003e% \n  select(region,long,lat,white,black,hispanic,asian,other) %\u003e% \n  group_by(region) %\u003e% \n  slice(1:1) %\u003e%\n  reshape2::melt(id.vars = c(\"region\",\"long\",\"lat\")) -\u003e nydata\nnydata %\u003e%\n  select(-lat, -long) %\u003e%\n  left_join(centroids, by=c(\"region\"=\"region\")) %\u003e% \n  select(region, long, lat, variable, value) -\u003e nydata2\n\n# draw the pies on a map\ngg \u003c- piesonmap(data=ny,map=ny,piedata=nydata2,locationdata=NULL, circlesize = 0.05)\ngg\n\n```\n\n![piesonamap](piesonamap.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachcp%2Fpiesonamap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachcp%2Fpiesonamap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachcp%2Fpiesonamap/lists"}