

{"id":5916,"date":"2017-05-07T11:37:14","date_gmt":"2017-05-07T16:37:14","guid":{"rendered":"https:\/\/rud.is\/b\/?p=5916"},"modified":"2018-03-07T17:18:18","modified_gmt":"2018-03-07T22:18:18","slug":"plot-the-vote-making-u-s-senate-house-cartograms-in-r","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/","title":{"rendered":"Plot the Vote: Making U.S. Senate &#038; House Cartograms in R"},"content":{"rendered":"<p>Political machinations are a tad insane in the U.S. these days &amp; I regularly hit up @ProPublica &amp; @GovTrack sites (&amp; sub to the GovTrack e-mail updates) as I try to be an informed citizen, especially since I&#8217;ve got a Senator and Representative who seem to be in the sway of ?.<\/p>\n<p>I&#8217;ve always appreciated the ProPublica and GovTrack cartograms as they present a great deal of information in a compact space (especially the House versions). Something nudged me into starting an R package to let folks create them in R (mainly with <code>ggplot2<\/code> but an <code>htmlwidget<\/code> version is planned), which I&#8217;ve dubbed <a href=\"https:\/\/github.com\/hrbrmstr\/voteogram\"><code>voteogram<\/code><\/a>.<\/p>\n<p>With the <code>voteogram<\/code> package, you can:<\/p>\n<ul>\n<li>pull ProPublica roll call vote data for the 101st Congress up through today (via <code>roll_call()<\/code>)<\/li>\n<li>plot ProPublica-esque Senate roll call vote cartograms<\/li>\n<li>plot ProPublica-esque House roll call vote cartograms<\/li>\n<li>plot GovTrack-esque House roll call vote cartograms<\/li>\n<\/ul>\n<p>GovTrack uses &mdash;\u00a0what I&#8217;ve seen @thosjleeper refer to as &mdash; a &#8220;parliamentary plot&#8221; for their version of the Senate roll call cartogram and sir Leeper already has that type of plot covered in <a href=\"https:\/\/github.com\/leeper\/ggparliament\"><code>ggparliament<\/code><\/a>, so I&#8217;ve just focused on the other ones here.<\/p>\n<h3>Roll Call<\/h3>\n<p>You need data for these cartogram generation functions and you can specify your own populated data frame (the needed columns are in the manual pages for the cartogram plotters). However, you&#8217;ll likely want to plot existing data that others have tallied and ProPublica makes that super simple since each vote is in a standalone JSON file. All you have to do is specify whether you want the roll call vote for the <code>house<\/code> or <code>senate<\/code>, the Congress number (current one is 115), the session number (current one is 1) and the roll call vote number.<\/p>\n<p>For example, we can see all the <strike>idiots<\/strike> Representatives who voted, recently, to <strike>kill people<\/strike> repeal the ACA with the following function call:<\/p>\n<pre id=\"vcarto-01\"><code class=\"language-r\">(h256 &lt;- roll_call(&quot;house&quot;, 115, 1, 256))\r\n## 115th Congress \/ Session: 1 \/ House Roll Call: 256 \/ May  4, 2017\r\n## \r\n## American Health Care Act\r\n## \r\n## Result: Passed\r\n\r\nstr(h256, max.level = 1)\r\n## List of 29\r\n##  $ vote_id              : chr &quot;H_115_1_256&quot;\r\n##  $ chamber              : chr &quot;House&quot;\r\n##  $ year                 : int 2017\r\n##  $ congress             : chr &quot;115&quot;\r\n##  $ session              : chr &quot;1&quot;\r\n##  $ roll_call            : int 256\r\n##  $ needed_to_pass       : int 216\r\n##  $ date_of_vote         : chr &quot;May  4, 2017&quot;\r\n##  $ time_of_vote         : chr &quot;02:18 PM&quot;\r\n##  $ result               : chr &quot;Passed&quot;\r\n##  $ vote_type            : chr &quot;RECORDED VOTE&quot;\r\n##  $ question             : chr &quot;On Passage&quot;\r\n##  $ description          : chr &quot;American Health Care Act&quot;\r\n##  $ nyt_title            : chr &quot;On Passage&quot;\r\n##  $ total_yes            : int 217\r\n##  $ total_no             : int 213\r\n##  $ total_not_voting     : int 1\r\n##  $ gop_yes              : int 217\r\n##  $ gop_no               : int 20\r\n##  $ gop_not_voting       : int 1\r\n##  $ dem_yes              : int 0\r\n##  $ dem_no               : int 193\r\n##  $ dem_not_voting       : int 0\r\n##  $ ind_yes              : int 0\r\n##  $ ind_no               : int 0\r\n##  $ ind_not_voting       : int 0\r\n##  $ dem_majority_position: chr &quot;No&quot;\r\n##  $ gop_majority_position: chr &quot;Yes&quot;\r\n##  $ votes                :Classes \u2018tbl_df\u2019, \u2018tbl\u2019 and &#039;data.frame&#039;:  435 obs. of  11 variables:\r\n##  - attr(*, &quot;class&quot;)= chr [1:2] &quot;pprc&quot; &quot;list&quot;<\/code><\/pre>\n<p>As you can see, it has a custom <code>print<\/code> function and the usable data (for cartographic needs) is in <code>$votes<\/code>. You can go to town with just that information, making bar charts or tracking individual Congress-critter votes.<\/p>\n<p>Do your best to cache this data as you retrieve it. ProPublica is a non-profit and the JSON files are on AWS. While there&#8217;s a certain number of free bits of bandwidth-per-month allotted buy Amazon&#8217;s S3 service, best to make sure you&#8217;re not tipping them over on any given month. Plus, the vote data doesn&#8217;t change once it&#8217;s recorded. Consider donating to them if you decided to always grab fresh copies.<\/p>\n<p>There&#8217;s a <code>fortify<\/code> function for this object (it&#8217;s classed <code>pprc<\/code>) so you can pass it right into <code>ggplot()<\/code> for use or pipe it into a <code>dplyr<\/code> chain for aggregation &amp; filtering.<\/p>\n<h3>House Rules<\/h3>\n<p>With the data in hand, we can make some cartograms (the real purpose of the package). I riffed off the ProPublica colors (and haven&#8217;t fully finished copying them yet as I need to search for 2 more categories of Independent voting colors) but you can replace them with anything you want. Just reset the scale and use the names in the exposed color value vectors.<\/p>\n<p>There&#8217;s also a <code>theme_voteogram()<\/code> which is designed to augment any base theme (like <code>hrbrthemes::theme_ipsum_rc()<\/code>) (it&#8217;s much like <code>ggthemes::theme_map()<\/code>).<\/p>\n<p>Here&#8217;s the ProPublica view for that particular vote:<\/p>\n<pre id=\"vcarto-02\"><code class=\"language-r\">house_carto(rep) +\r\n  labs(x=NULL, y=NULL, \r\n       title=&quot;House Vote 256 - Passes American Health Care Act,\\nRepealing Obamacare&quot;) +\r\n  theme_ipsum_rc(plot_title_size = 24) +\r\n  theme_voteogram()<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_pp-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5917\" data-permalink=\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/rep_pp-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_pp-1.png?fit=1920%2C1344&amp;ssl=1\" data-orig-size=\"1920,1344\" 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=\"rep_pp-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_pp-1.png?fit=300%2C210&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_pp-1.png?fit=510%2C357&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_pp-1.png?resize=510%2C357&#038;ssl=1\" alt=\"\" width=\"510\" height=\"357\" class=\"aligncenter size-full wp-image-5917\" \/><\/a><\/p>\n<p>The <code>house_carto()<\/code> function defaults to the ProPublica cartogram, but you can easily change that:<\/p>\n<pre id=\"vcarto-03\"><code class=\"language-r\">house_carto(rep, &quot;gt&quot;) +\r\n  labs(x=NULL, y=NULL, \r\n       title=&quot;House Vote 256 - Passes American Health Care Act,\\nRepealing Obamacare&quot;) +\r\n  theme_ipsum_rc(plot_title_size = 24) +\r\n  theme_voteogram()<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5918\" data-permalink=\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/rep_gt-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&amp;ssl=1\" data-orig-size=\"1920,1344\" 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=\"rep_gt-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=300%2C210&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=510%2C357&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?resize=510%2C357&#038;ssl=1\" alt=\"\" width=\"510\" height=\"357\" class=\"aligncenter size-full wp-image-5918\" \/><\/a><\/p>\n<h3>Senate Drools<\/h3>\n<p>Again, the <code>senate_carto()<\/code> function only has the ProPublica-esque cartogram available and works pretty much the same way after getting the Senate vote data:<\/p>\n<pre id=\"vcarto-04\"><code class=\"language-r\">sen &lt;- roll_call(&quot;senate&quot;, 115, 1, 110)\r\n\r\nsenate_carto(sen) +\r\n  labs(title=&quot;Senate Vote 110 - Invokes Cloture on Neil Gorsuch Nomination&quot;) +\r\n  theme_ipsum_rc(plot_title_size = 24) +\r\n  theme_voteogram()<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/sen-1.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"5920\" data-permalink=\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/sen-1\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/sen-1.png?fit=1920%2C1344&amp;ssl=1\" data-orig-size=\"1920,1344\" 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=\"sen-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/sen-1.png?fit=300%2C210&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/sen-1.png?fit=510%2C357&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/sen-1.png?resize=510%2C357&#038;ssl=1\" alt=\"\" width=\"510\" height=\"357\" class=\"aligncenter size-full wp-image-5920\" \/><\/a><\/p>\n<h3>FIN<\/h3>\n<p>There&#8217;s a bit of work left to do in the package (including an <code>htmlwidget<\/code> version). You&#8217;re invited to file <a href=\"https:\/\/github.com\/hrbrmstr\/voteogram\/pulls\">PRs<\/a> or <a href=\"https:\/\/github.com\/hrbrmstr\/voteogram\/issues\">Issues<\/a> as you are so moved.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Political machinations are a tad insane in the U.S. these days &amp; I regularly hit up @ProPublica &amp; @GovTrack sites (&amp; sub to the GovTrack e-mail updates) as I try to be an informed citizen, especially since I&#8217;ve got a Senator and Representative who seem to be in the sway of ?. I&#8217;ve always appreciated [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5918,"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,706,91],"tags":[810],"class_list":["post-5916","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cartography","category-ggplot","category-maps","category-r","tag-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Plot the Vote: Making U.S. Senate &amp; House Cartograms 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\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Plot the Vote: Making U.S. Senate &amp; House Cartograms in R - rud.is\" \/>\n<meta property=\"og:description\" content=\"Political machinations are a tad insane in the U.S. these days &amp; I regularly hit up @ProPublica &amp; @GovTrack sites (&amp; sub to the GovTrack e-mail updates) as I try to be an informed citizen, especially since I&#8217;ve got a Senator and Representative who seem to be in the sway of ?. I&#8217;ve always appreciated [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-07T16:37:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T22:18:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1344\" \/>\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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Plot the Vote: Making U.S. Senate &#038; House Cartograms in R\",\"datePublished\":\"2017-05-07T16:37:14+00:00\",\"dateModified\":\"2018-03-07T22:18:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\"},\"wordCount\":636,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1\",\"keywords\":[\"post\"],\"articleSection\":[\"cartography\",\"ggplot\",\"maps\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\",\"url\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\",\"name\":\"Plot the Vote: Making U.S. Senate & House Cartograms in R - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1\",\"datePublished\":\"2017-05-07T16:37:14+00:00\",\"dateModified\":\"2018-03-07T22:18:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1\",\"width\":1920,\"height\":1344},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Plot the Vote: Making U.S. Senate &#038; House Cartograms 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":"Plot the Vote: Making U.S. Senate & House Cartograms 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\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/","og_locale":"en_US","og_type":"article","og_title":"Plot the Vote: Making U.S. Senate & House Cartograms in R - rud.is","og_description":"Political machinations are a tad insane in the U.S. these days &amp; I regularly hit up @ProPublica &amp; @GovTrack sites (&amp; sub to the GovTrack e-mail updates) as I try to be an informed citizen, especially since I&#8217;ve got a Senator and Representative who seem to be in the sway of ?. I&#8217;ve always appreciated [&hellip;]","og_url":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/","og_site_name":"rud.is","article_published_time":"2017-05-07T16:37:14+00:00","article_modified_time":"2018-03-07T22:18:18+00:00","og_image":[{"width":1920,"height":1344,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Plot the Vote: Making U.S. Senate &#038; House Cartograms in R","datePublished":"2017-05-07T16:37:14+00:00","dateModified":"2018-03-07T22:18:18+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/"},"wordCount":636,"commentCount":9,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","keywords":["post"],"articleSection":["cartography","ggplot","maps","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/","url":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/","name":"Plot the Vote: Making U.S. Senate & House Cartograms in R - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","datePublished":"2017-05-07T16:37:14+00:00","dateModified":"2018-03-07T22:18:18+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","width":1920,"height":1344},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2017\/05\/07\/plot-the-vote-making-u-s-senate-house-cartograms-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Plot the Vote: Making U.S. Senate &#038; House Cartograms 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\/2017\/05\/rep_gt-1.png?fit=1920%2C1344&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-1xq","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":7269,"url":"https:\/\/rud.is\/b\/2017\/11\/27\/voteogram-is-now-on-cran\/","url_meta":{"origin":5916,"position":0},"title":"voteogram Is Now On CRAN","author":"hrbrmstr","date":"2017-11-27","format":false,"excerpt":"Earlier this year, I made a package that riffed off of ProPublica's really neat voting cartograms (maps) for the U.S. House and Senate. You can see one for disaster relief spending in the House and one for the ACA \"Skinny Repeal\" in the Senate. We can replicate both here with\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\/2017\/11\/plot_zoom_png-1-2.png?fit=1063%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/plot_zoom_png-1-2.png?fit=1063%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/plot_zoom_png-1-2.png?fit=1063%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/plot_zoom_png-1-2.png?fit=1063%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/11\/plot_zoom_png-1-2.png?fit=1063%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":10860,"url":"https:\/\/rud.is\/b\/2018\/06\/03\/hello-dorling-creating-dorling-cartograms-from-r-spatial-objects-introducing-prism-skeleton\/","url_meta":{"origin":5916,"position":1},"title":"Hello, Dorling! (Creating Dorling Cartograms from R Spatial Objects + Introducing Prism Skeleton)","author":"hrbrmstr","date":"2018-06-03","format":false,"excerpt":"NOTE: There is some iframed content in this post and you can bust out of it if you want to see the document in a full browser window. Also, apologies for some lingering GitHub links. I'm waiting for all the repos to import into to other services and haven't had\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\/2018\/06\/dorling.png?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/06\/dorling.png?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/06\/dorling.png?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/06\/dorling.png?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2018\/06\/dorling.png?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7149,"url":"https:\/\/rud.is\/b\/2017\/11\/18\/statebins-reimagined\/","url_meta":{"origin":5916,"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":4429,"url":"https:\/\/rud.is\/b\/2016\/06\/12\/on-whether-y-axis-labels-are-always-necessary\/","url_meta":{"origin":5916,"position":3},"title":"On Whether Y-axis Labels Are Always Necessary","author":"hrbrmstr","date":"2016-06-12","format":false,"excerpt":"The infamous @albertocairo [blogged about](http:\/\/www.thefunctionalart.com\/2016\/06\/propublica-visualizes-seasonality-in.html) a [nice interactive piece on German company tax avoidance](https:\/\/projects.propublica.org\/graphics\/dividend) by @ProPublica. Here's a snapshot of their interactive chart: ![](https:\/\/2.bp.blogspot.com\/-S-8bu1UdYWM\/V1rXibnBxrI\/AAAAAAAAGo0\/L940SpU3DvUPX90JK82jrKQN6fWMyn2IACLcB\/s1600\/1prop.png) Dr. Cairo (his PhD is in the bag as far as I'm concerned :-) posited: >_Isn't it weird that the chart doesn't have a scale on\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\/06\/Plot_Zoom.png?fit=1200%2C1036&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/06\/Plot_Zoom.png?fit=1200%2C1036&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/06\/Plot_Zoom.png?fit=1200%2C1036&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/06\/Plot_Zoom.png?fit=1200%2C1036&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/06\/Plot_Zoom.png?fit=1200%2C1036&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":12510,"url":"https:\/\/rud.is\/b\/2019\/09\/14\/twitter-account-analysis-in-r\/","url_meta":{"origin":5916,"position":4},"title":"Twitter &#8220;Account Analysis&#8221; in R","author":"hrbrmstr","date":"2019-09-14","format":false,"excerpt":"This past week @propublica linked to a really spiffy resource for getting an overview of a Twitter user's profile and activity called accountanalysis. It has a beautiful interface that works as well on mobile as it does in a real browser. It also is fully interactive and supports cross-filtering (zoom\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":12667,"url":"https:\/\/rud.is\/b\/2020\/03\/02\/make-wsj-esque-uber-tuesday-democrat-delegate-cartograms-in-r-with-catchpole\/","url_meta":{"origin":5916,"position":5},"title":"Make WSJ-esque \u00dcber Tuesday Democrat Delegate Cartograms in R with {catchpole}","author":"hrbrmstr","date":"2020-03-02","format":false,"excerpt":"For folks who are smart enough not to go near Twitter, I've been on a hiatus from the platform insofar as reading the Twitter feed goes. \"Why\" isn't the subject of this post so I won't go into it, but I've broken this half-NYE resolution on more than one occasion\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\/2020\/03\/my-map-2.png?fit=1200%2C784&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/my-map-2.png?fit=1200%2C784&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/my-map-2.png?fit=1200%2C784&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/my-map-2.png?fit=1200%2C784&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2020\/03\/my-map-2.png?fit=1200%2C784&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/5916","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=5916"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/5916\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/5918"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=5916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=5916"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=5916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}