

{"id":4285,"date":"2016-04-12T19:56:48","date_gmt":"2016-04-13T00:56:48","guid":{"rendered":"http:\/\/rud.is\/b\/?p=4285"},"modified":"2018-09-06T06:06:50","modified_gmt":"2018-09-06T11:06:50","slug":"beating-lollipops-into-dumbbells","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/","title":{"rendered":"Beating lollipops into dumbbells"},"content":{"rendered":"<p>Shortly after I added <a href=\"https:\/\/rud.is\/b\/2016\/04\/07\/geom_lollipop-by-the-chartettes\/\">lollipop charts to <code>ggalt<\/code><\/a> I had a few requests for <a href=\"http:\/\/annkemery.com\/portfolio\/dumbbell-dot\/\">a dumbbell geom<\/a>. It wasn&#8217;t difficult to do modify the underlying lollipop <code>Geom<\/code>s to make a <code>geom_dumbbell()<\/code>. Here it is in action:<\/p>\n<pre><code class=\"language-r\">library(ggplot2)\nlibrary(ggalt) # devtools::install_github(\"hrbrmstr\/ggalt\")\nlibrary(dplyr)\n\n# from: https:\/\/plot.ly\/r\/dumbbell-plots\/\nURL <- \"https:\/\/raw.githubusercontent.com\/plotly\/datasets\/master\/school_earnings.csv\"\nfil <- basename(URL)\nif (!file.exists(fil)) download.file(URL, fil)\n\ndf <- read.csv(fil, stringsAsFactors=FALSE)\ndf <- arrange(df, desc(Men))\ndf <- mutate(df, School=factor(School, levels=rev(School)))\n\ngg <- ggplot(df, aes(x=Women, xend=Men, y=School))\ngg <- gg + geom_dumbbell(colour=\"#686868\",\n                         point.colour.l=\"#ffc0cb\",\n                         point.colour.r=\"#0000ff\",\n                         point.size.l=2.5,\n                         point.size.r=2.5)\ngg <- gg + scale_x_continuous(breaks=seq(60, 160, by=20),\n                              labels=sprintf(\"$%sK\", comma(seq(60, 160, by=20))))\ngg <- gg + labs(x=\"Annual Salary\", y=NULL,\n                title=\"Gender Earnings Disparity\",\n                caption=\"Data from plotly\")\ngg <- gg + theme_bw()\ngg <- gg + theme(axis.ticks=element_blank())\ngg <- gg + theme(panel.grid.minor=element_blank())\ngg <- gg + theme(panel.border=element_blank())\ngg <- gg + theme(axis.title.x=element_text(hjust=1, face=\"italic\", margin=margin(t=-24)))\ngg <- gg + theme(plot.caption=element_text(size=8, margin=margin(t=24)))\ngg<\/code><\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"510\" height=\"444\" data-attachment-id=\"4288\" data-permalink=\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/fullscreen_4_12_16__8_38_pm\/\" data-orig-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&amp;ssl=1\" data-orig-size=\"1236,1077\" 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=\"Fullscreen_4_12_16__8_38_PM\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=300%2C261&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=510%2C444&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?resize=510%2C444&#038;ssl=1\" alt=\"Fullscreen_4_12_16__8_38_PM\" class=\"aligncenter size-full wp-image-4288\" \/><\/a><\/p>\n<p>The API isn't locked in, so definitely <a href=\"https:\/\/github.com\/hrbrmstr\/ggalt\/issues\">file an issue<\/a> if you want different or additional functionality. One issue I personally still have is how to identify the left\/right points (blue is male and pink is female in this one).<\/p>\n<h3>Working Out With Dumbbells<\/h3>\n<p>I thought folks might like to see behind the <em>ggcurtain<\/em>. It really only took the addition of two functions to <code>ggalt<\/code>: <code>geom_dumbbell()<\/code> (which you call directly) and <code>GeomDumbbell()<\/code> which acts behind the scenes.<\/p>\n<p>There are a few additional, custom parameters to <code>geom_dumbbell()<\/code> and the mapped <code>stat<\/code> and <code>position<\/code> are hardcoded in the <code>layer<\/code> call. We also pass in these new parameters into the <code>params<\/code> list.<\/p>\n<pre><code class=\"language-r\">geom_dumbbell <- function(mapping = NULL, data = NULL, ...,\n                          point.colour.l = NULL, point.size.l = NULL,\n                          point.colour.r = NULL, point.size.r = NULL,\n                          na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) {\n\n  layer(\n    data = data,\n    mapping = mapping,\n    stat = \"identity\",\n    geom = GeomDumbbell,\n    position = \"identity\",\n    show.legend = show.legend,\n    inherit.aes = inherit.aes,\n    params = list(\n      na.rm = na.rm,\n      point.colour.l = point.colour.l,\n      point.size.l = point.size.l,\n      point.colour.r = point.colour.r,\n      point.size.r = point.size.r,\n      ...\n    )\n  )\n}<\/code><\/pre>\n<p>The exposed function eventually calls it's paired <code>Geom<\/code>. There we get to tell it what are required <code>aes<\/code> parameters and which ones aren't required, plus set some defaults.<\/p>\n<p>We automagically add <code>yend<\/code> to the data in <code>setup_data()<\/code> (which gets called by the <code>ggplot2<\/code> API).<\/p>\n<p>Then, in <code>draw_group()<\/code> we create additional <code>data.frame<\/code>s and return a list of three <code>Geom<\/code> layers (two points and one segment). Finally, we provide a default legend symbol.<\/p>\n<pre><code class=\"language-r\">GeomDumbbell <- ggproto(\"GeomDumbbell\", Geom,\n  required_aes = c(\"x\", \"xend\", \"y\"),\n  non_missing_aes = c(\"size\", \"shape\",\n                      \"point.colour.l\", \"point.size.l\",\n                      \"point.colour.r\", \"point.size.r\"),\n  default_aes = aes(\n    shape = 19, colour = \"black\", size = 0.5, fill = NA,\n    alpha = NA, stroke = 0.5\n  ),\n\n  setup_data = function(data, params) {\n    transform(data, yend = y)\n  },\n\n  draw_group = function(data, panel_scales, coord,\n                        point.colour.l = NULL, point.size.l = NULL,\n                        point.colour.r = NULL, point.size.r = NULL) {\n\n    points.l <- data\n    points.l$colour <- point.colour.l %||% data$colour\n    points.l$size <- point.size.l %||% (data$size * 2.5)\n\n    points.r <- data\n    points.r$x <- points.r$xend\n    points.r$colour <- point.colour.r %||% data$colour\n    points.r$size <- point.size.r %||% (data$size * 2.5)\n\n    gList(\n      ggplot2::GeomSegment$draw_panel(data, panel_scales, coord),\n      ggplot2::GeomPoint$draw_panel(points.l, panel_scales, coord),\n      ggplot2::GeomPoint$draw_panel(points.r, panel_scales, coord)\n    )\n\n  },\n\n  draw_key = draw_key_point\n)<\/code><\/pre>\n<p>In essence, this new geom saves calls to three additional <code>geom_<\/code>s, but does add more parameters, so it's not really clear if it saves much typing.<\/p>\n<p>If you end up making anything interesting with <code>geom_dumbbell()<\/code> I encourage you to drop a note in the comments with a link.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shortly after I added lollipop charts to ggalt I had a few requests for a dumbbell geom. It wasn&#8217;t difficult to do modify the underlying lollipop Geoms to make a geom_dumbbell(). Here it is in action: library(ggplot2) library(ggalt) # devtools::install_github(&#8220;hrbrmstr\/ggalt&#8221;) library(dplyr) # from: https:\/\/plot.ly\/r\/dumbbell-plots\/ URL<\/p>\n","protected":false},"author":1,"featured_media":4288,"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":[24,678,673,674,753,91],"tags":[810],"class_list":["post-4285","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-charts-graphs","category-data-visualization","category-datavis-2","category-dataviz","category-ggplot","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>Beating lollipops into dumbbells - 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\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Beating lollipops into dumbbells - rud.is\" \/>\n<meta property=\"og:description\" content=\"Shortly after I added lollipop charts to ggalt I had a few requests for a dumbbell geom. It wasn&#8217;t difficult to do modify the underlying lollipop Geoms to make a geom_dumbbell(). Here it is in action: library(ggplot2) library(ggalt) # devtools::install_github(&quot;hrbrmstr\/ggalt&quot;) library(dplyr) # from: https:\/\/plot.ly\/r\/dumbbell-plots\/ URL\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-13T00:56:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-09-06T11:06:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1236\" \/>\n\t<meta property=\"og:image:height\" content=\"1077\" \/>\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<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Beating lollipops into dumbbells\",\"datePublished\":\"2016-04-13T00:56:48+00:00\",\"dateModified\":\"2018-09-06T11:06:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\"},\"wordCount\":256,\"commentCount\":10,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1\",\"keywords\":[\"post\"],\"articleSection\":[\"Charts &amp; Graphs\",\"Data Visualization\",\"DataVis\",\"DataViz\",\"ggplot\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\",\"url\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\",\"name\":\"Beating lollipops into dumbbells - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1\",\"datePublished\":\"2016-04-13T00:56:48+00:00\",\"dateModified\":\"2018-09-06T11:06:50+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1\",\"width\":1236,\"height\":1077},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Beating lollipops into dumbbells\"}]},{\"@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":"Beating lollipops into dumbbells - 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\/2016\/04\/12\/beating-lollipops-into-dumbbells\/","og_locale":"en_US","og_type":"article","og_title":"Beating lollipops into dumbbells - rud.is","og_description":"Shortly after I added lollipop charts to ggalt I had a few requests for a dumbbell geom. It wasn&#8217;t difficult to do modify the underlying lollipop Geoms to make a geom_dumbbell(). Here it is in action: library(ggplot2) library(ggalt) # devtools::install_github(\"hrbrmstr\/ggalt\") library(dplyr) # from: https:\/\/plot.ly\/r\/dumbbell-plots\/ URL","og_url":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/","og_site_name":"rud.is","article_published_time":"2016-04-13T00:56:48+00:00","article_modified_time":"2018-09-06T11:06:50+00:00","og_image":[{"width":1236,"height":1077,"url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","type":"image\/png"}],"author":"hrbrmstr","twitter_card":"summary_large_image","twitter_misc":{"Written by":"hrbrmstr"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Beating lollipops into dumbbells","datePublished":"2016-04-13T00:56:48+00:00","dateModified":"2018-09-06T11:06:50+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/"},"wordCount":256,"commentCount":10,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"image":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","keywords":["post"],"articleSection":["Charts &amp; Graphs","Data Visualization","DataVis","DataViz","ggplot","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/","url":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/","name":"Beating lollipops into dumbbells - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"primaryImageOfPage":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage"},"image":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","datePublished":"2016-04-13T00:56:48+00:00","dateModified":"2018-09-06T11:06:50+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#primaryimage","url":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","contentUrl":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","width":1236,"height":1077},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2016\/04\/12\/beating-lollipops-into-dumbbells\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Beating lollipops into dumbbells"}]},{"@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\/2016\/04\/Fullscreen_4_12_16__8_38_PM.png?fit=1236%2C1077&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p23idr-177","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":5050,"url":"https:\/\/rud.is\/b\/2017\/02\/15\/ggalt-0-4-0-now-on-cran\/","url_meta":{"origin":4285,"position":0},"title":"ggalt 0.4.0 now on CRAN","author":"hrbrmstr","date":"2017-02-15","format":false,"excerpt":"I'm uncontainably excited to report that the ggplot2 extension package ggalt is now on CRAN. The absolute best part of this package is the R community members who contributed suggestions and new geoms, stats, annotations and integration features. This release would not be possible without the PRs from: Ben Bolker\u2026","rel":"","context":"In &quot;ggplot&quot;","block_context":{"text":"ggplot","link":"https:\/\/rud.is\/b\/category\/ggplot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-1.png?fit=1200%2C510&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-1.png?fit=1200%2C510&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-1.png?fit=1200%2C510&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-1.png?fit=1200%2C510&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-1.png?fit=1200%2C510&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4254,"url":"https:\/\/rud.is\/b\/2016\/04\/07\/geom_lollipop-by-the-chartettes\/","url_meta":{"origin":4285,"position":1},"title":"geom_lollipop() by the Chartettes","author":"hrbrmstr","date":"2016-04-07","format":false,"excerpt":">UPDATE: Changed code to reflect the new `horizontal` parameter for `geom_lollipop()` I make a fair share of bar charts throughout the day and really like switching to lollipop charts to mix things up a bit and enhance the visual appeal. They're easy to do in `ggplot2`, just use your traditional\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\/04\/download.png?fit=1200%2C1114&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/download.png?fit=1200%2C1114&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/download.png?fit=1200%2C1114&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/download.png?fit=1200%2C1114&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/download.png?fit=1200%2C1114&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":4345,"url":"https:\/\/rud.is\/b\/2016\/04\/17\/ggplot2-exercising-with-ggalt-dumbbells\/","url_meta":{"origin":4285,"position":2},"title":"(ggplot2) Exercising with (ggalt) dumbbells","author":"hrbrmstr","date":"2016-04-17","format":false,"excerpt":"I follow the most excellent Pew Research folks on Twitter to stay in tune with what's happening (statistically speaking) with the world. Today, they tweeted this excerpt from their 2015 Global Attitudes survey: The age gap in social media use around the world https:\/\/t.co\/0Dq1PcbExG pic.twitter.com\/9HBM7gLxwR\u2014 PewResearch Internet (@pewinternet) April 17,\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\/04\/RStudio.png?fit=811%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/RStudio.png?fit=811%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/RStudio.png?fit=811%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/04\/RStudio.png?fit=811%2C1200&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3832,"url":"https:\/\/rud.is\/b\/2015\/12\/28\/world-map-panel-plots-with-ggplot2-2-0-ggalt\/","url_meta":{"origin":4285,"position":3},"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":12282,"url":"https:\/\/rud.is\/b\/2019\/06\/06\/make-multi-point-dumbbell-plots-in-ggplot2\/","url_meta":{"origin":4285,"position":4},"title":"Make Multi-point &#8220;dumbbell&#8221; Plots in ggplot2","author":"hrbrmstr","date":"2019-06-06","format":false,"excerpt":"A user of the {ggalt} package recently posted a question about how to add points to a geom_dumbbell() plot. For now, this is not something you can do with geom_dumbbell() but with a bit of data wrangling you can do this in a pretty straightforward manner with just your data\u2026","rel":"","context":"In &quot;ggplot&quot;","block_context":{"text":"ggplot","link":"https:\/\/rud.is\/b\/category\/ggplot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/06\/there-are-three-points-2.png?fit=1200%2C560&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/06\/there-are-three-points-2.png?fit=1200%2C560&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/06\/there-are-three-points-2.png?fit=1200%2C560&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/06\/there-are-three-points-2.png?fit=1200%2C560&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2019\/06\/there-are-three-points-2.png?fit=1200%2C560&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":5055,"url":"https:\/\/rud.is\/b\/2017\/02\/18\/putting-it-all-together\/","url_meta":{"origin":4285,"position":5},"title":"Putting It All Together","author":"hrbrmstr","date":"2017-02-18","format":false,"excerpt":"The kind folks over at @RStudio gave a nod to my recently CRAN-released epidata package in their January data package roundup and I thought it might be useful to give it one more showcase using the recent CRAN update to ggalt and the new hrbrthemes (github-only for now) packages. Labor\u2026","rel":"","context":"In &quot;ggplot&quot;","block_context":{"text":"ggplot","link":"https:\/\/rud.is\/b\/category\/ggplot\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-3.png?fit=1200%2C395&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-3.png?fit=1200%2C395&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-3.png?fit=1200%2C395&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-3.png?fit=1200%2C395&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2017\/02\/RStudio-3.png?fit=1200%2C395&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/4285","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=4285"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/4285\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media\/4288"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=4285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=4285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=4285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}