

{"id":3302,"date":"2015-03-12T20:45:10","date_gmt":"2015-03-13T01:45:10","guid":{"rendered":"http:\/\/rud.is\/b\/?p=3302"},"modified":"2018-03-07T16:44:04","modified_gmt":"2018-03-07T21:44:04","slug":"streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations","status":"publish","type":"post","link":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/","title":{"rendered":"Streamgraph htmlwidget version 0.7 released (adds support for markers &#038; annotations)"},"content":{"rendered":"<p>In preparation for using some of our streamgraphs for production (PDF\/print) graphics, I ended up having to hand-edit labels in on one of the graphics in an Adobe product. This bumped up the priority on adding annotation functions to the streamgraph package (you really don&#8217;t want to have to hand-edit graphics if at all possible, trust me). To illustrate them, I&#8217;ll use unemployment data that I started gathering for a course I&#8217;m teaching in the Fall.<\/p>\n<p>We&#8217;ll start with the setup and initial data gathering:<\/p>\n<pre lang=\"rsplus\">library(dplyr)\r\nlibrary(streamgraph)\r\nlibrary(pbapply)\r\n\r\nurl <- \"http:\/\/www.bls.gov\/lau\/ststdsadata.txt\"\r\ndat <- readLines(url)<\/pre>\n<p>This data is not exactly in a happy format (hit the URL in your browser and you'll see what I mean). It was definitely made for line printers\/human consumption and I feel bad for any human that has to stare at it. The function I'm using to extract data is not necessarily what I'd do to just read in the whole data, but it's more for teaching something else than optimization. It'll do for our purposes here:<\/p>\n<pre lang=\"rsplus\">get_state_data <- function(state) {\r\n\r\n  section <- paste(\"^%s|    (\", paste0(month.name, sep=\"\", collapse=\"|\"), \")\\ +[[:digit:]]{4}\", sep=\"\", collapse=\"\")\r\n  section <- sprintf(section, state)\r\n  vals <- gsub(\"^\\ +|\\ +$\", \"\", grep(section, dat, value=TRUE))\r\n\r\n  state_vals <- gsub(\"^.* \\\\.+\", \"\", vals[seq(from=2, to=length(vals), by=2)])\r\n\r\n  cols <- read.table(text=state_vals)\r\n  cols$month <- as.Date(sprintf(\"01 %s\", vals[seq(from=1, to=length(vals), by=2)]),\r\n                        format=\"%d %B %Y\")\r\n  cols$state <- state\r\n\r\n  cols %>%\r\n    select(8:9, 1:8) %>%\r\n    mutate(V1=as.numeric(gsub(\",\", \"\", V1)),\r\n           V2=as.numeric(gsub(\",\", \"\", V2)),\r\n           V4=as.numeric(gsub(\",\", \"\", V4)),\r\n           V6=as.numeric(gsub(\",\", \"\", V6)),\r\n           V3=V3\/100,\r\n           V5=V5\/100,\r\n           V7=V7\/100) %>%\r\n    rename(civ_pop=V1,\r\n           labor_force=V2, labor_force_pct=V3,\r\n           employed=V4, employed_pct=V5,\r\n           unemployed=V6, unemployed_pct=V7)\r\n\r\n}\r\n\r\nstate_unemployment <- bind_rows(pblapply(state.name, get_state_data))<\/pre>\n<p>This will give us a data frame for employment(\/unemployment) rates for all the (US) states. I only wanted to focus on New England and a few others for the course example, so this bit filters out them out:<\/p>\n<pre lang=\"rsplus\">state_unemployment %>%\r\n  filter(state %in% c(\"California\", \"Ohio\", \"Rhode Island\", \"Maine\",\r\n                      \"Massachusetts\", \"Connecticut\", \"Vermont\",\r\n                      \"New Hampshire\", \"Nebraska\")) -> some<\/pre>\n<p>With that setup out of the way, let me introduce the two new functions: `sg_add_marker` and `sg_annotate`. `sg_add_marker` adds a vertical, dotted line that spans the height of the graph and is placed at the designated spot on the x axis. You can add an optional label for the marker by specifying the y position, label text, color, size, space away from the line and how it's aligned - start (left), center (middle), right (end). This is primarily useful for placing the label on either side of the line.<\/p>\n<p>`sg_annotate` is for adding text anywhere on the streamgraph. The original use for it was to label streams, but you can use it any way you think would add meaning to your streamgraph. You can see them both in action below, where I plot the streamgraph for unemployment (%) for the selected states, then label the start of each recession since 1980 (with the peak national unemployment rate) with a marker and also label each stream:<\/p>\n<pre lang=\"rsplus\">streamgraph(some, \"state\", \"unemployed_pct\", \"month\") %>%\r\n  sg_axis_x(tick_interval=10, tick_units = \"year\", tick_format=\"%Y\") %>%\r\n  sg_axis_y(0) %>%\r\n  sg_add_marker(x=as.Date(\"1981-07-01\"), \"1981 (10.8%)\", anchor=\"end\") %>%\r\n  sg_add_marker(x=as.Date(\"1990-07-01\"), \"1990 (7.8%)\", anchor=\"start\") %>%\r\n  sg_add_marker(x=as.Date(\"2001-03-01\"), \"2001 (6.3%)\", anchor=\"end\") %>%\r\n  sg_add_marker(x=as.Date(\"2007-12-01\"), \"2007 (10.1%)\", anchor=\"end\") %>%\r\n  sg_annotate(label=\"Vermont\", x=as.Date(\"1978-04-01\"), y=0.6, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Maine\", x=as.Date(\"1978-03-01\"), y=0.30, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Nebraska\", x=as.Date(\"1977-06-01\"), y=0.41, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Massachusetts\", x=as.Date(\"1977-06-01\"), y=0.36, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"New Hampshire\", x=as.Date(\"1978-03-01\"), y=0.435, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"California\", x=as.Date(\"1978-02-01\"), y=0.175, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Rhode Island\", x=as.Date(\"1977-11-01\"), y=0.55, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Ohio\", x=as.Date(\"1978-06-01\"), y=0.485, color=\"#ffffff\") %>%\r\n  sg_annotate(label=\"Connecticut\", x=as.Date(\"1978-01-01\"), y=0.235, color=\"#ffffff\") %>%\r\n  sg_fill_tableau() %>%\r\n  sg_legend(show=TRUE)<\/pre>\n<p><center><b>Selected State Unemployment Figures Since 1976<\/b><iframe loading=\"lazy\" style=\"max-width=100%\" src=\"\/b\/sg\/sgannmrk.html\" sandbox=\"allow-same-origin allow-scripts\" width=\"100%\" height=\"470\" scrolling=\"no\" seamless=\"seamless\" frameBorder=\"0\"><\/iframe><\/center><\/p>\n<p>I probably could have positioned the annotations a bit better, but this should be a good enough example to get the general idea. I may add an option to place the marker vertical lines behind streamgraph and will be adding some toggle options to the interactive version (to hide\/show markers and\/or annotations).<\/p>\n<p>As usual, the package is up [on github](https:\/\/github.com\/hrbrmstr\/streamgraph) and a contiguous copy of the above snippets are in [this gist](https:\/\/gist.github.com\/hrbrmstr\/4e181ae045807ca3a858).<\/p>\n<p>Three final notes. First, I suggest enabling the y axis when you're trying to figure out where the y position for a label should be (since the y axis range is calculated by the summed span of the data). Second, the x axis works with both dates and continuous values, but you need to match what you setup the streamgraph with. Finally, just a tip: I've found [SVG Crowbar 2](http:\/\/nytimes.github.io\/svg-crowbar\/) to be super-helpful when I need to extract these streamgraphs out for non-interactive reproduction. Just yank the SVG out with it and hand it (or a converted form of it) to whomever is handling final production and they should be able to work with it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In preparation for using some of our streamgraphs for production (PDF\/print) graphics, I ended up having to hand-edit labels in on one of the graphics in an Adobe product. This bumped up the priority on adding annotation functions to the streamgraph package (you really don&#8217;t want to have to hand-edit graphics if at all possible, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"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":[666,673,674,91],"tags":[810],"class_list":["post-3302","post","type-post","status-publish","format-standard","hentry","category-d3","category-datavis-2","category-dataviz","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>Streamgraph htmlwidget version 0.7 released (adds support for markers &amp; annotations) - 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\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Streamgraph htmlwidget version 0.7 released (adds support for markers &amp; annotations) - rud.is\" \/>\n<meta property=\"og:description\" content=\"In preparation for using some of our streamgraphs for production (PDF\/print) graphics, I ended up having to hand-edit labels in on one of the graphics in an Adobe product. This bumped up the priority on adding annotation functions to the streamgraph package (you really don&#8217;t want to have to hand-edit graphics if at all possible, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\" \/>\n<meta property=\"og:site_name\" content=\"rud.is\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-13T01:45:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-07T21:44:04+00:00\" \/>\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\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\"},\"author\":{\"name\":\"hrbrmstr\",\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"headline\":\"Streamgraph htmlwidget version 0.7 released (adds support for markers &#038; annotations)\",\"datePublished\":\"2015-03-13T01:45:10+00:00\",\"dateModified\":\"2018-03-07T21:44:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\"},\"wordCount\":605,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886\"},\"keywords\":[\"post\"],\"articleSection\":[\"d3\",\"DataVis\",\"DataViz\",\"R\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\",\"url\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\",\"name\":\"Streamgraph htmlwidget version 0.7 released (adds support for markers & annotations) - rud.is\",\"isPartOf\":{\"@id\":\"https:\/\/rud.is\/b\/#website\"},\"datePublished\":\"2015-03-13T01:45:10+00:00\",\"dateModified\":\"2018-03-07T21:44:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/rud.is\/b\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Streamgraph htmlwidget version 0.7 released (adds support for markers &#038; annotations)\"}]},{\"@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":"Streamgraph htmlwidget version 0.7 released (adds support for markers & annotations) - 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\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/","og_locale":"en_US","og_type":"article","og_title":"Streamgraph htmlwidget version 0.7 released (adds support for markers & annotations) - rud.is","og_description":"In preparation for using some of our streamgraphs for production (PDF\/print) graphics, I ended up having to hand-edit labels in on one of the graphics in an Adobe product. This bumped up the priority on adding annotation functions to the streamgraph package (you really don&#8217;t want to have to hand-edit graphics if at all possible, [&hellip;]","og_url":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/","og_site_name":"rud.is","article_published_time":"2015-03-13T01:45:10+00:00","article_modified_time":"2018-03-07T21:44:04+00:00","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\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#article","isPartOf":{"@id":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/"},"author":{"name":"hrbrmstr","@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"headline":"Streamgraph htmlwidget version 0.7 released (adds support for markers &#038; annotations)","datePublished":"2015-03-13T01:45:10+00:00","dateModified":"2018-03-07T21:44:04+00:00","mainEntityOfPage":{"@id":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/"},"wordCount":605,"commentCount":4,"publisher":{"@id":"https:\/\/rud.is\/b\/#\/schema\/person\/d7cb7487ab0527447f7fda5c423ff886"},"keywords":["post"],"articleSection":["d3","DataVis","DataViz","R"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/","url":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/","name":"Streamgraph htmlwidget version 0.7 released (adds support for markers & annotations) - rud.is","isPartOf":{"@id":"https:\/\/rud.is\/b\/#website"},"datePublished":"2015-03-13T01:45:10+00:00","dateModified":"2018-03-07T21:44:04+00:00","breadcrumb":{"@id":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/rud.is\/b\/2015\/03\/12\/streamgraph-htmlwidget-version-0-7-released-adds-support-for-markers-annotations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/rud.is\/b\/"},{"@type":"ListItem","position":2,"name":"Streamgraph htmlwidget version 0.7 released (adds support for markers &#038; annotations)"}]},{"@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":"","jetpack_shortlink":"https:\/\/wp.me\/p23idr-Rg","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3278,"url":"https:\/\/rud.is\/b\/2015\/02\/15\/introducing-the-streamgraph-htmlwidget-r-pacakge\/","url_meta":{"origin":3302,"position":0},"title":"Introducing the streamgraph htmlwidget R Package","author":"hrbrmstr","date":"2015-02-15","format":false,"excerpt":"We were looking for a different type of visualization for a project at work this past week and my thoughts immediately gravitated towards [streamgraphs](http:\/\/www.leebyron.com\/else\/streamgraph\/). The TLDR on streamgraphs is they they are generalized versions of stacked area graphs with free baselines across the x axis. They are somewhat [controversial](http:\/\/www.visualisingdata.com\/index.php\/2010\/08\/making-sense-of-streamgraphs\/) but\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3292,"url":"https:\/\/rud.is\/b\/2015\/03\/07\/streamgraph-package-now-supports-continuous-x-axis-scale\/","url_meta":{"origin":3302,"position":1},"title":"Streamgraph package now supports continuous x axis scale","author":"hrbrmstr","date":"2015-03-07","format":false,"excerpt":"A post on [StackOverflow](http:\/\/stackoverflow.com\/questions\/28725604\/streamgraphs-dataviz-in-r-wont-plot) asked about using a continuous variable for the x-axis (vs dates) in my [streamgraph package](http:\/\/github.com\/hrbrmstr\/streamgraph). While I provided a workaround for the question, it helped me bump up the priority for adding support for continuous x axis scales. With the [DBIR](http:\/\/www.verizonenterprise.com\/DBIR\/) halfway behind me now, I\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":3364,"url":"https:\/\/rud.is\/b\/2015\/03\/30\/3364\/","url_meta":{"origin":3302,"position":2},"title":"A look at airline crashes in R with googlesheets, dplyr &#038; ggplot2","author":"hrbrmstr","date":"2015-03-30","format":false,"excerpt":"Over on The DO Loop, @RickWicklin does a nice job [visualizing the causes of airline crashes](http:\/\/blogs.sas.com\/content\/iml\/2015\/03\/30\/visualizing-airline-crashes\/) in SAS using a mosaic plot. More often than not, I find mosaic plots can be a bit difficult to grok, but Rick's use was spot on and I believe it shows the data\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":3977,"url":"https:\/\/rud.is\/b\/2016\/02\/27\/create-vega-lite-specs-widgets-with-the-vegalite-package\/","url_meta":{"origin":3302,"position":3},"title":"Create Vega-Lite specs &#038; widgets with the vegalite package","author":"hrbrmstr","date":"2016-02-27","format":false,"excerpt":"[Vega-Lite](http:\/\/vega.github.io\/vega-lite\/) 1.0 was [released this past week](https:\/\/medium.com\/@uwdata\/introducing-vega-lite-438f9215f09e#.yfkl0tp1c). I had been meaning to play with it for a while but I've been burned before by working with unstable APIs and was waiting for this to bake to a stable release. Thankfully, there were no new shows in the Fire TV, Apple\u2026","rel":"","context":"In &quot;d3&quot;","block_context":{"text":"d3","link":"https:\/\/rud.is\/b\/category\/d3\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/rud.is\/b\/wp-content\/uploads\/2016\/02\/gallery.png?fit=1200%2C595&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3340,"url":"https:\/\/rud.is\/b\/2015\/03\/20\/fixing-colors-proportions-in-jerusalem-post-election-graphics\/","url_meta":{"origin":3302,"position":4},"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":3215,"url":"https:\/\/rud.is\/b\/2015\/01\/10\/new-r-package-cdcfluview-retrieve-flu-data-from-cdcs-fluview-portal\/","url_meta":{"origin":3302,"position":5},"title":"New R Package: cdcfluview \u2014 Retrieve Flu Data from CDC&#8217;s FluView Portal","author":"hrbrmstr","date":"2015-01-10","format":false,"excerpt":"**NOTE** If there's a particular data set from http:\/\/www.cdc.gov\/flu\/weekly\/fluviewinteractive.htm that you want and that isn't in the pacakge, please file it as an issue and be as specific as you can (screen shot if possible). ----- Towards the end of 2014 I had been tinkering with flu data from the\u2026","rel":"","context":"In &quot;DataVis&quot;","block_context":{"text":"DataVis","link":"https:\/\/rud.is\/b\/category\/datavis-2\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3302","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=3302"}],"version-history":[{"count":0,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/posts\/3302\/revisions"}],"wp:attachment":[{"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/media?parent=3302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/categories?post=3302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rud.is\/b\/wp-json\/wp\/v2\/tags?post=3302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}