

{"id":11445,"date":"2018-08-27T13:45:04","date_gmt":"2018-08-27T18:45:04","guid":{"rendered":"https:\/\/rud.is\/b\/?p=11445"},"modified":"2018-08-27T13:45:04","modified_gmt":"2018-08-27T18:45:04","slug":"simplifying-world-tile-grid-creation-with-geom_wtg","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/","title":{"rendered":"Simplifying World Tile Grid Creation with geom_wtg()"},"content":{"rendered":"<p>Nowadays (I&#8217;ve seen that word used <em>so<\/em> much in journal articles lately that I could not resist using it) I&#8217;m using world tile grids more frequently as the need arises to convey the state of exposure of various services at a global (country) scale. Given that necessity fosters invention it seemed that having a ggplot2 geom for world tile grids would make my life easier and also make work more efficient.<\/p>\n<p>To that end, there&#8217;s a nascent ggplot2 extension package for making world tile grids called (uncreatively) <a href=\"https:\/\/gitlab.com\/hrbrmstr\/worldtilegrid\"><code>worldtilegrid<\/code>?<\/a>. It&#8217;s also at GitHub if you&#8217;re more comfortable working from code from there.<\/p>\n<p>The <a href=\"https:\/\/gitlab.com\/hrbrmstr\/worldtilegrid#readme\">README<\/a> has examples but we&#8217;ll walk through another one here and work with life expectancy data curated by <a href=\"https:\/\/ourworldindata.org\/life-expectancy\">Our World in Data<\/a>. Rather than draw out this post to a less tenable length with an explanation of how to pull the XHR JSON data into R, just grab the CSV linked with the visualization on that page and substitute the path in the code for where you stored it.<\/p>\n<p>We do need to clean up this data a bit since it has some issues. Let&#8217;s do that and carve out some slices into two new data frames so we can work with the most recent curated year and some historical data:<\/p>\n<pre><code class=\"language-r\">library(hrbrthemes) # gitlab\/github :: hrbrmstr\/hrbrthemes (use devtools installers)\nlibrary(worldtilegrid) # gitlab\/github :: hrbrmstr\/worldtilegrid (use devtools installers)\nlibrary(tidyverse)\n\ncols(\n  Entity = col_character(),\n  Code = col_character(),\n  Year = col_integer(),\n  `Life expectancy (Clio-Infra up to 1949; UN Population Division for 1950 to 2015)` = col_double()\n) -> le_cols\n\nread_csv(\"~\/Downloads\/life-expectancy.csv\", col_types = le_cols) %>%\n  set_names(c(\"country\", \"iso3c\", \"year\", \"life_expectancy\")) -> lifexp\n\n# clean it up a bit since it's not great data and bust it into groups\n# that match the vis on the site vs use continuous raw data, esp since\n# the data is really just estimates\nfilter(lifexp, !is.na(iso3c)) %>%\n  filter(nchar(iso3c) == 3) %>%\n  mutate(\n    grp = cut(\n      x = life_expectancy,\n      breaks = c(10, 20, 30, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85),\n      include.lowest = TRUE\n    )\n  ) -> lifexp\n\nlast_year <-  filter(lifexp, year == last(year))\na_few_years <- filter(lifexp, year %in% c(seq(1900, 2015, 20), 2015))<\/code><\/pre>\n<p>Now we can use it to make some cartograms.<\/p>\n<h3>Using the World Tile Grid geom<\/h3>\n<p>You can <a href=\"https:\/\/rud.is\/b\/2018\/06\/07\/making-world-tile-grid-grids\/\">reference a previous post<\/a> for what it would normally take to create these tile grids. The idea was to simplify the API down to the caller just needing to specify some country names\/ISO[23]Cs (to a <code>country<\/code> aesthetic) and a value (to a <code>fill<\/code> aesthetic) and let the package do the rest. To that end, here's how to display the life expectancy data for 2015:<\/p>\n<pre><code class=\"language-r\">ggplot(last_year) +\n  geom_wtg(aes(country = iso3c, fill = grp), border_col = \"#2b2b2b\") + # yep, you can sum up the entire blog post to this one line\n  viridis::scale_fill_viridis(\n    name = \"Life Expectancy\", discrete = TRUE, na.value=alpha(ft_cols$gray, 1\/10),\n    drop = FALSE\n  ) +\n  coord_equal() +\n  labs(\n    x=NULL, y=NULL,\n    title = \"Life expectancy, 2015\",\n    subtitle = \"Shown is period life expectancy at birth. This corresponds to an estimate of the average number\\nof years a newborn infant would live if prevailing patterns of mortality at the time of its birth were to\\nstay the same throughout its life\",\n    caption = \"Data source: <https:\/\/ourworldindata.org\/life-expectancy>\"\n\n  ) +\n  theme_ft_rc(grid=\"\") +\n  theme(axis.text=element_blank()) +\n  theme(legend.position = \"bottom\")<\/code><\/pre>\n<p><a href=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/le-wtg-01\/\" rel=\"attachment wp-att-11447\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"11447\" data-permalink=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/le-wtg-01\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-01.png?fit=2232%2C1696&amp;ssl=1\" data-orig-size=\"2232,1696\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"le-wtg-01\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-01.png?fit=300%2C228&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-01.png?fit=510%2C388&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-01.png?resize=510%2C388&#038;ssl=1\" alt=\"\" width=\"510\" height=\"388\" class=\"aligncenter size-full wp-image-11447\" \/><\/a><\/p>\n<p>You can add labels via <code>geom_text()<\/code> and use the <code>wtg<\/code> stat for it as it provides a number of computed variables you can work with:<\/p>\n<ul>\n<li><code>x<\/code>,<code>y<\/code>: the X,Y position of the tile<\/li>\n<li><code>name<\/code>: Country name (e.g. Afghanistan)<\/li>\n<li><code>country.code<\/code>: ISO2C country code abbreviation (e.g. AF)<\/li>\n<li><code>iso_3166.2<\/code>: Full ISO 3166 2-letter abbreviation code (e.g. ISO 3166-2:AF)<\/li>\n<li><code>region<\/code>: Region name (e.g. Asia)<\/li>\n<li><code>sub.region<\/code>: Sub-region name (e.g. Southern Asia)<\/li>\n<li><code>region.code<\/code>: Region code (e.g. 142)<\/li>\n<li><code>sub.region.code<\/code>: Sub-region code (e.g. 034)<\/li>\n<\/ul>\n<p>Labeling should be a deliberate decision and used sparingly\/with care.<\/p>\n<h3>Easier World Tile Grid Facets<\/h3>\n<p>Making faceted charts is also straightforward. Just use ggplot2's faceting subsytem:<\/p>\n<pre><code class=\"language-r\">ggplot(a_few_years) +\n  geom_wtg(aes(country = iso3c, fill = grp), border_col = \"#2b2b2b\") +\n  viridis::scale_fill_viridis(\n    name = \"Life Expectancy\", discrete = TRUE, na.value=alpha(ft_cols$gray, 1\/10),\n    drop = FALSE\n  ) +\n  coord_equal() +\n  labs(\n    x=NULL, y=NULL,\n    title = \"Life expectancy, 1900-2015 (selected years)\",\n    subtitle = \"Shown is period life expectancy at birth. This corresponds to an estimate of the average number of years a newborn infant\\nwould live if prevailing patterns of mortality at the time of its birth were to stay the same throughout its life\",\n    caption = \"Data source: <https:\/\/ourworldindata.org\/life-expectancy>\"\n  ) +\n  facet_wrap(~year) +\n  theme_ft_rc(grid=\"\") +\n  theme(axis.text=element_blank()) +\n  theme(legend.position = \"bottom\")<\/code><\/pre>\n<p><a href=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/le-wtg-02\/\" rel=\"attachment wp-att-11446\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"11446\" data-permalink=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/le-wtg-02\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&amp;ssl=1\" data-orig-size=\"1886,2362\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"le-wtg-02\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=240%2C300&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=510%2C639&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?resize=510%2C639&#038;ssl=1\" alt=\"\" width=\"510\" height=\"639\" class=\"aligncenter size-full wp-image-11446\" \/><\/a><\/p>\n<p>(You may want to open that one up in a separate tab\/window.)<\/p>\n<p>Animation might have been a better choice than facets (which is an exercise left to the reader ?).<\/p>\n<h3>FIN<\/h3>\n<p>The package API is still in \"rapidly changing\" mode, but feel free to kick the tyres and file issues or PRs on your community coding platform of choice as needed.<\/p>\n<p>As noted in the package, the world tile grid concept credit goes to Jon Schwabish and the CSV data used to create the package exposed <code>wtg<\/code> data frame is the work of Maarten Lambrechts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nowadays (I&#8217;ve seen that word used so much in journal articles lately that I could not resist using it) I&#8217;m using world tile grids more frequently as the need arises to convey the state of exposure of various services at a global (country) scale. Given that necessity fosters invention it seemed that having a ggplot2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11446,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[753,91],"tags":[],"class_list":["post-11445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ggplot","category-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Simplifying World Tile Grid Creation with geom_wtg() - rud.is<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simplifying World Tile Grid Creation with geom_wtg() - rud.is\" \/>\n<meta property=\"og:description\" content=\"Nowadays (I&#8217;ve seen that word used so much in journal articles lately that I could not resist using it) I&#8217;m using world tile grids more frequently as the need arises to convey the state of exposure of various services at a global (country) scale. Given that necessity fosters invention it seemed that having a ggplot2 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-27T18:45:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1886\" \/>\n\t<meta property=\"og:image:height\" content=\"2362\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"hrbrmstr\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"hrbrmstr\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Simplifying World Tile Grid Creation with geom_wtg()\",\"datePublished\":\"2018-08-27T18:45:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\"},\"wordCount\":502,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1\",\"articleSection\":[\"ggplot\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\",\"url\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\",\"name\":\"Simplifying World Tile Grid Creation with geom_wtg() - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1\",\"datePublished\":\"2018-08-27T18:45:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1\",\"width\":1886,\"height\":2362},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Simplifying World Tile Grid Creation with geom_wtg()\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/rud.is\/b\/#website\",\"url\":\"https:\/\/rud.is\/b\/\",\"name\":\"rud.is\",\"description\":\"&quot;In God we trust. All others must bring data&quot;\",\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/rud.is\/b\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\",\"name\":\"hrbrmstr\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\",\"width\":460,\"height\":460,\"caption\":\"hrbrmstr\"},\"logo\":{\"@id\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1\"},\"description\":\"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7\",\"sameAs\":[\"http:\/\/rud.is\"],\"url\":\"https:\/\/rud.is\/b\/author\/hrbrmstr\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Simplifying World Tile Grid Creation with geom_wtg() - rud.is","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/","og_locale":"en_US","og_type":"article","og_title":"Simplifying World Tile Grid Creation with geom_wtg() - rud.is","og_description":"Nowadays (I&#8217;ve seen that word used so much in journal articles lately that I could not resist using it) I&#8217;m using world tile grids more frequently as the need arises to convey the state of exposure of various services at a global (country) scale. Given that necessity fosters invention it seemed that having a ggplot2 [&hellip;]","og_url":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/","og_site_name":"rud.is","article_published_time":"2018-08-27T18:45:04+00:00","og_image":[{"width":1886,"height":2362,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Simplifying World Tile Grid Creation with geom_wtg()","datePublished":"2018-08-27T18:45:04+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/"},"wordCount":502,"commentCount":1,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","articleSection":["ggplot","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/","url":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/","name":"Simplifying World Tile Grid Creation with geom_wtg() - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","datePublished":"2018-08-27T18:45:04+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","width":1886,"height":2362},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2018\/08\/27\/simplifying-world-tile-grid-creation-with-geom_wtg\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Simplifying World Tile Grid Creation with geom_wtg()"}]},{"@type":"WebSite","@id":"https:\/\/rud.is\/b\/#website","url":"https:\/\/rud.is\/b\/","name":"rud.is","description":"&quot;In God we trust. All others must bring data&quot;","publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/rud.is\/b\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886","name":"hrbrmstr","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1","width":460,"height":460,"caption":"hrbrmstr"},"logo":{"@id":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2023\/10\/ukr-shield.png?fit=460%2C460&ssl=1"},"description":"Don't look at me\u2026I do what he does \u2014 just slower. #rstats avuncular \u2022 ?Resistance Fighter \u2022 Cook \u2022 Christian \u2022 [Master] Chef des Donn\u00e9es de S\u00e9curit\u00e9 @ @rapid7","sameAs":["http:\/\/rud.is"],"url":"https:\/\/rud.is\/b\/author\/hrbrmstr\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/08\/le-wtg-02.png?fit=1886%2C2362&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-2YB","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":10886,"url":"https:\/\/rud.is\/b\/2018\/06\/07\/making-world-tile-grid-grids\/","url_meta":{"origin":11445,"position":0},"title":"Making World Tile Grid-Grids","author":"hrbrmstr","date":"2018-06-07","format":false,"excerpt":"A colleague asked if I would blog about how I crafted the grid of world tile grids in this post and I accepted the challenge. The technique isn't too hard as it just builds on the initial work by Jon Schwabish and a handy file made by Maarten Lambrechts. The\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3243,"url":"https:\/\/rud.is\/b\/2015\/02\/01\/new-release-0-7-of-metricsgraphics-htmlwidget-grids-rollovers\/","url_meta":{"origin":11445,"position":1},"title":"New release (0.7) of metricsgraphics htmlwidget \u2014 grids &#038; rollovers","author":"hrbrmstr","date":"2015-02-01","format":false,"excerpt":"I've updated my [metricsgraphics](https:\/\/github.com\/hrbrmstr\/metricsgraphics) package to version [0.7](https:\/\/github.com\/hrbrmstr\/metricsgraphics\/releases\/tag\/v0.7). The core [MetricsGraphics](http:\/\/metricsgraphicsjs.org) JavaScript library has been updated to version 2.1.0 (from 1.1.0). Two blog-worthy features since releasing version 0.5 are `mjs_grid` (which is a `grid.arrange`-like equivalent for `metricsgraphics` plots and `mjs_add_rollover` which lets you add your own custom rollover text to\u2026","rel":"","context":"In &quot;Charts &amp; Graphs&quot;","block_context":{"text":"Charts &amp; Graphs","link":"https:\/\/rud.is\/b\/category\/charts-graphs\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3832,"url":"https:\/\/rud.is\/b\/2015\/12\/28\/world-map-panel-plots-with-ggplot2-2-0-ggalt\/","url_meta":{"origin":11445,"position":2},"title":"World Map Panel Plots with ggplot2 2.0 &#038; ggalt","author":"hrbrmstr","date":"2015-12-28","format":false,"excerpt":"James Austin (@awhstin) made some #spiffy 4-panel maps with base R graphics but also posited he didn't use ggplot2 because: \u2026ggplot2 and maps currently do not support world maps at this point, which does not give us a great overall view. That is certainly a box I would not put\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/facetmaps.png?fit=1154%2C722&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/facetmaps.png?fit=1154%2C722&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/facetmaps.png?fit=1154%2C722&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/facetmaps.png?fit=1154%2C722&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/12\/facetmaps.png?fit=1154%2C722&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":12195,"url":"https:\/\/rud.is\/b\/2019\/05\/18\/mapping-tornado-alley-with-r\/","url_meta":{"origin":11445,"position":3},"title":"Mapping Tornado Alley with R","author":"hrbrmstr","date":"2019-05-18","format":false,"excerpt":"I caught a re-tweet of this tweet by @harry_stevens: THREAD: I wrote a post on @observablehq about a map I made today. It shows a typical day in the life of a graphics journalist: You never know what problems you'll have to solve on deadline! https:\/\/t.co\/yRhW1wbLxN #d3js #dataviz 1\/7 pic.twitter.com\/7N6mmK0nz3\u2014\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/05\/map-final-header.png?fit=1001%2C970&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4501,"url":"https:\/\/rud.is\/b\/2016\/07\/07\/bridging-the-political-polygons-gap-with-ggplot2\/","url_meta":{"origin":11445,"position":4},"title":"Bridging The Political [Polygons] Gap with ggplot2","author":"hrbrmstr","date":"2016-07-07","format":false,"excerpt":"The @pewresearch folks have been collecting political survey data for quite a while, and I noticed the [visualization below](http:\/\/www.people-press.org\/2014\/06\/12\/section-1-growing-ideological-consistency\/#interactive) referenced in a [Tableau vis contest entry](https:\/\/www.interworks.com\/blog\/rrouse\/2016\/06\/24\/politics-viz-contest-plotting-political-polarization): Those are filled [frequency polygons](http:\/\/onlinestatbook.com\/2\/graphing_distributions\/freq_poly.html), which are super-easy to replicate in ggplot2, especially since Pew even _kind of_ made the data available via their\u2026","rel":"","context":"In &quot;Data Visualization&quot;","block_context":{"text":"Data Visualization","link":"https:\/\/rud.is\/b\/category\/data-visualization\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/07\/engfull.png?fit=1200%2C1098&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4133,"url":"https:\/\/rud.is\/b\/2016\/03\/16\/supreme-annotations\/","url_meta":{"origin":11445,"position":5},"title":"Supreme Annotations","author":"hrbrmstr","date":"2016-03-16","format":false,"excerpt":"This is a follow up to a twitter-gist post & to the annotation party we're having this week I had not intended this to be \"Annotation Week\" but there was a large, positive response to my annotation \"hack\" post. This reaction surprised me, then someone pointed me to this link\u2026","rel":"","context":"In &quot;Charts &amp; Graphs&quot;","block_context":{"text":"Charts &amp; Graphs","link":"https:\/\/rud.is\/b\/category\/charts-graphs\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/supremes.png?fit=1200%2C987&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/supremes.png?fit=1200%2C987&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/supremes.png?fit=1200%2C987&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/supremes.png?fit=1200%2C987&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/03\/supremes.png?fit=1200%2C987&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/11445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/comments?post=11445"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/11445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/11446"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=11445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=11445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=11445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}