

{"id":11612,"date":"2018-10-10T04:39:50","date_gmt":"2018-10-10T09:39:50","guid":{"rendered":"https:\/\/rud.is\/b\/?p=11612"},"modified":"2018-10-10T04:39:50","modified_gmt":"2018-10-10T09:39:50","slug":"geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/","title":{"rendered":"GeoJSON  Version of CBC Quebec Ridings Hex Cartograms with  Example Usage in R"},"content":{"rendered":"<p>The CBC covered the recent (as of the original post-time on this blog entry) <a href=\"https:\/\/www.cbc.ca\/news\/canada\/montreal\/8-maps-that-explain-quebec-s-surprise-election-results-1.4848794\">Quebec elections<\/a> and used a well-crafted hex grid map to display results:<\/p>\n<p><a href=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/quebec-hexagon-electoral-map-ridings\/\" rel=\"attachment wp-att-11613\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"11613\" data-permalink=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/quebec-hexagon-electoral-map-ridings\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/quebec-hexagon-electoral-map-ridings.jpg?fit=780%2C733&amp;ssl=1\" data-orig-size=\"780,733\" 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=\"quebec-hexagon-electoral-map-ridings\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/quebec-hexagon-electoral-map-ridings.jpg?fit=510%2C479&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/quebec-hexagon-electoral-map-ridings.jpg?resize=510%2C479&#038;ssl=1\" alt=\"\" width=\"510\" height=\"479\" class=\"aligncenter size-full wp-image-11613\" \/><\/a><\/p>\n<p>They have a <a href=\"https:\/\/ici.radio-canada.ca\/special\/2018\/elections-quebec\/circonscriptions-portrait-cartes-vote-analyse-politique\/en\">great &#8216;splainer<\/a> on why they use this type of map.<\/p>\n<p>Thinking that it may be useful for others, I used a browser Developer Tools inspector to yank out the javascript-created SVG and wrangled out the hexes using <a href=\"https:\/\/www.npmjs.com\/package\/svg2geojson\"><code>svg2geojson<\/code>?<\/a> and put them into a <a href=\"https:\/\/gitlab.com\/hrbrmstr\/quebec-hex-ridings\">GeoJSON file<\/a> along with some metadata that I extracted from the minified javascript from the CBC&#8217;s site and turned into a data frame using the <a href=\"https:\/\/cran.r-project.org\/web\/packages\/V8\/index.html\"><code>V8<\/code>?<\/a> package. Since most of the aforementioned work was mouse clicking and ~8 (disjointed) lines of accompanying super-basic R code, there&#8217;s not really much to show wrangling-wise<sup>1<\/sup>, but I <em>can<\/em> show an example of using the new GeoJSON file in R and the <a href=\"https:\/\/cran.r-project.org\/web\/packages\/sf\/index.html\"><code>sf<\/code>?<\/a> package:<\/p>\n<pre><code class=\"language-r\">library(sf)\nlibrary(ggplot2)\n\n# get the GeoJSON file from: https:\/\/gitlab.com\/hrbrmstr\/quebec-hex-ridings or https:\/\/github.com\/hrbrmstr\/quebec-hex-ridings\nsf::st_read(\"quebec-ridings.geojson\", quiet = TRUE, stringsAsFactors = FALSE) %&gt;% \n  ggplot() +\n  geom_sf(aes(fill = regionname)) +\n  coord_sf(datum = NA) +\n  ggthemes::scale_fill_tableau(name = NULL, \"Tableau 20\") +\n  ggthemes::theme_map() +\n  theme(legend.position = \"bottom\")\n<\/code><\/pre>\n<p><a href=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/ggplot-sf\/\" rel=\"attachment wp-att-11614\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"11614\" data-permalink=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/ggplot-sf\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&amp;ssl=1\" data-orig-size=\"2400,1800\" 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=\"ggplot-sf\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=510%2C383&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?resize=510%2C383&#038;ssl=1\" alt=\"\" width=\"510\" height=\"383\" class=\"aligncenter size-full wp-image-11614\" \/><\/a><\/p>\n<p>And, with a <em>little more<\/em> ggplot2-tweaking and some <code>magick<\/code>, we can even put it in the CBC-styled border:<\/p>\n<pre><code class=\"language-r\">library(sf)\nlibrary(magick)\nlibrary(ggplot2)\n\nplt &lt;- image_graph(1488, 1191, bg = \"white\")\nsf::st_read(\"quebec-ridings.geojson\", quiet=TRUE, stringsAsFactors=FALSE) %&gt;% \n  ggplot() +\n  geom_sf(aes(fill=regionname)) +\n  coord_sf(datum=NA) +\n  scale_x_continuous(expand=c(0,2)) +\n  scale_y_continuous(expand=c(0,0)) +\n  ggthemes::theme_map() +\n  theme(plot.margin = margin(t=150)) +\n  theme(legend.position = \"none\")\ndev.off()\n\n# get this bkgrnd img from the repo\nimage_composite(plt, image_read(\"imgs\/background.png\")) %&gt;% \n  image_write(\"imgs\/composite-map.png\")\n<\/code><\/pre>\n<p><a href=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/composite-map\/\" rel=\"attachment wp-att-11615\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"11615\" data-permalink=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/composite-map\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/composite-map.png?fit=1488%2C1191&amp;ssl=1\" data-orig-size=\"1488,1191\" 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=\"composite-map\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/composite-map.png?fit=510%2C408&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/composite-map.png?resize=510%2C408&#038;ssl=1\" alt=\"\" width=\"510\" height=\"408\" class=\"aligncenter size-full wp-image-11615\" \/><\/a><\/p>\n<p>You can tweak the border color with <a href=\"https:\/\/cran.r-project.org\/web\/packages\/magick\/index.html\"><code>magick<\/code>?<\/a> as needed and there&#8217;s a <code>background2.png<\/code> in the <code>imgs<\/code> directory in the repo that has the white inset that you can further composite as needed.<\/p>\n<p>With a teensy bit of work you should be able adjust the stroke color via <code>aes()<\/code> to separate things as the CBC did.<\/p>\n<h3>FIN<\/h3>\n<p>It&#8217;s important to re-state that the CBC made the original polygons for the hexes (well, they made a set of grid points and open source software turned it into a set of SVG paths) and the background images. All I did was some extra bit of wrangling and conversionating<sup>2<\/sup>.<\/p>\n<p><span style=\"font-size:9pt\"><sup>1<\/sup> I can toss a screencast if there&#8217;s sufficient interest.<\/span><br \/>\n<span style=\"font-size:9pt\"><sup>2<\/sup> Totally not a word.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The CBC covered the recent (as of the original post-time on this blog entry) Quebec elections and used a well-crafted hex grid map to display results: They have a great &#8216;splainer on why they use this type of map. Thinking that it may be useful for others, I used a browser Developer Tools inspector to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":11614,"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":[721,753,91],"tags":[],"class_list":["post-11612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cartography","category-ggplot","category-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - 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\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - rud.is\" \/>\n<meta property=\"og:description\" content=\"The CBC covered the recent (as of the original post-time on this blog entry) Quebec elections and used a well-crafted hex grid map to display results: They have a great &#8216;splainer on why they use this type of map. Thinking that it may be useful for others, I used a browser Developer Tools inspector to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-10T09:39:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1800\" \/>\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\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R\",\"datePublished\":\"2018-10-10T09:39:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/\"},\"wordCount\":289,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#\\\/schema\\\/person\\\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/ggplot-sf.png?fit=2400%2C1800&ssl=1\",\"articleSection\":[\"cartography\",\"ggplot\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/\",\"url\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/\",\"name\":\"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - rud.is\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/ggplot-sf.png?fit=2400%2C1800&ssl=1\",\"datePublished\":\"2018-10-10T09:39:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/ggplot-sf.png?fit=2400%2C1800&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/rud.is\\\/b\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/ggplot-sf.png?fit=2400%2C1800&ssl=1\",\"width\":2400,\"height\":1800},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/rud.is\\\/b\\\/2018\\\/10\\\/10\\\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/rud.is\\\/b\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R\"}]},{\"@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":"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - 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\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/","og_locale":"en_US","og_type":"article","og_title":"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - rud.is","og_description":"The CBC covered the recent (as of the original post-time on this blog entry) Quebec elections and used a well-crafted hex grid map to display results: They have a great &#8216;splainer on why they use this type of map. Thinking that it may be useful for others, I used a browser Developer Tools inspector to [&hellip;]","og_url":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/","og_site_name":"rud.is","article_published_time":"2018-10-10T09:39:50+00:00","og_image":[{"width":2400,"height":1800,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&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\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R","datePublished":"2018-10-10T09:39:50+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/"},"wordCount":289,"commentCount":2,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1","articleSection":["cartography","ggplot","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/","url":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/","name":"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1","datePublished":"2018-10-10T09:39:50+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1","width":2400,"height":1800},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2018\/10\/10\/geojson-version-of-cbc-quebec-ridings-hex-cartograms-with-example-usage-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"GeoJSON Version of CBC Quebec Ridings Hex Cartograms with Example Usage in R"}]},{"@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\/10\/ggplot-sf.png?fit=2400%2C1800&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-31i","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":11894,"url":"https:\/\/rud.is\/b\/2019\/02\/09\/quick-hit-speeding-up-a-slow-mundane-task-with-a-little-rcpp\/","url_meta":{"origin":11612,"position":0},"title":"Quick Hit: Speeding Up a Slow\/Mundane Task with a Little Rcpp","author":"hrbrmstr","date":"2019-02-09","format":false,"excerpt":"Over at $DAYJOB's blog I've queued up a post that shows how to use our new ropendata? package to work with our Open Data portal's API. I'm not super-sure when it's going to be posted so keep an RSS reader fixed on https:\/\/blog.rapid7.com\/ if you're interested in seeing it (I\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/rud.is\/b\/category\/c\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3340,"url":"https:\/\/rud.is\/b\/2015\/03\/20\/fixing-colors-proportions-in-jerusalem-post-election-graphics\/","url_meta":{"origin":11612,"position":1},"title":"Fixing Colors &#038; Proportions in Jerusalem Post Election Graphics","author":"hrbrmstr","date":"2015-03-20","format":false,"excerpt":"Vis expert Naomi Robbins did an excellent [critique](http:\/\/www.forbes.com\/sites\/naomirobbins\/2015\/03\/19\/color-problems-with-figures-from-the-jerusalem-post\/) of the [graphics](http:\/\/www.jpost.com\/Israel-Elections\/Analysis-The-Israel-election-decided-by-one-vote-394229) that went along with an article on Israeli election in the Jerusalem Post. Non-uniform and color-blind-unfriendly categorical colors and disproportionate arc sizes are definitely three substantial issues in that series of visualizations. We can rectify all of them with\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":7149,"url":"https:\/\/rud.is\/b\/2017\/11\/18\/statebins-reimagined\/","url_meta":{"origin":11612,"position":2},"title":"Statebins Reimagined","author":"hrbrmstr","date":"2017-11-18","format":false,"excerpt":"A long time ago, in a github repo far, far away there lived a tiny package that made it possible to create equal area, square U.S. state cartograms in R dubbed statebins?. Three years have come and gone and --- truth be told --- I've never been happy with that\u2026","rel":"","context":"In &quot;R&quot;","block_context":{"text":"R","link":"https:\/\/rud.is\/b\/category\/r\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-3-1.png?fit=1200%2C857&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-3-1.png?fit=1200%2C857&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-3-1.png?fit=1200%2C857&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-3-1.png?fit=1200%2C857&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/unnamed-chunk-3-1.png?fit=1200%2C857&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3054,"url":"https:\/\/rud.is\/b\/2014\/09\/26\/overcoming-d3-cartographic-envy-with-r-ggplot\/","url_meta":{"origin":11612,"position":3},"title":"Overcoming D3 Cartographic Envy With R + ggplot","author":"hrbrmstr","date":"2014-09-26","format":false,"excerpt":"When I used one of the Scotland TopoJSON files for a recent post, it really hit me just how much D3 cartography envy I had\/have as an R user. Don't get me wrong, I can conjure up D3 maps pretty well [1] [2] and the utility of an interactive map\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":3563,"url":"https:\/\/rud.is\/b\/2015\/07\/26\/making-staticinteractive-voronoi-map-layers-in-ggplotleaflet\/","url_meta":{"origin":11612,"position":4},"title":"Making Static\/Interactive Voronoi Map Layers In ggplot\/leaflet","author":"hrbrmstr","date":"2015-07-26","format":false,"excerpt":"Despite having shown various ways to overcome D3 cartographic envy, there are always more examples that can cause the green monster to rear it's ugly head. Take the Voronoi Arc Map example. For those in need of a primer, a Voronoi tesslation\/diagram is: \u2026a partitioning of a plane into regions\u2026","rel":"","context":"In &quot;cartography&quot;","block_context":{"text":"cartography","link":"https:\/\/rud.is\/b\/category\/cartography\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3700,"url":"https:\/\/rud.is\/b\/2015\/10\/04\/replicating-natgeos-proper-earthquake-map-in-r\/","url_meta":{"origin":11612,"position":5},"title":"Replicating NatGeo&#8217;s &#8220;Proper&#8221; Earthquake Map in R","author":"hrbrmstr","date":"2015-10-04","format":false,"excerpt":"I saw this post over at NatGeo over the weekend and felt compelled to replicate this: with ggplot2. Three shapefiles later and we have it close enough to toss into a post (and I really don't believe the continent names are necessary). library(rgdal) library(ggplot2) library(ggthemes) library(ggalt) # devtools::install_github(\"hrbrmstr\/ggalt\") # grab\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\/10\/unnamed-chunk-1-1.png?fit=1200%2C685&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/10\/unnamed-chunk-1-1.png?fit=1200%2C685&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/10\/unnamed-chunk-1-1.png?fit=1200%2C685&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/10\/unnamed-chunk-1-1.png?fit=1200%2C685&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2015\/10\/unnamed-chunk-1-1.png?fit=1200%2C685&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/11612","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=11612"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/11612\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/11614"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=11612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=11612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=11612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}