{"id":775,"date":"2015-10-14T15:34:16","date_gmt":"2015-10-14T23:34:16","guid":{"rendered":"http:\/\/skyeome.net\/wordpress\/?p=775"},"modified":"2015-12-07T15:29:34","modified_gmt":"2015-12-07T23:29:34","slug":"new-ndtv-release-0-7","status":"publish","type":"post","link":"https:\/\/skyeome.net\/wordpress\/?p=775","title":{"rendered":"new ndtv release: 0.7"},"content":{"rendered":"<p>..and continuing in the thread of long-overdue R package updates, we&#8217;ve got a new <a href=\"https:\/\/cran.r-project.org\/web\/packages\/ndtv\/index.html\">ndtv<\/a> version out as well. <\/p>\n<h2>Peek into the time prism<\/h2>\n<p>The package release adds some &#8220;whiteboard candy&#8221;: 2.5D orthogonal projection of networks in time along a z axis. For lack of a better name, I&#8217;ve dubbed it a <code>timePrism<\/code> (let me know if you find a pre- existing better name). Think of viewing all of the slices from a filmstrip from an angle.  Probably hard to follow for large networks (or lots of time slices) but nice for illustrating concepts in temporal networks when you want to convey time and structure and can accept some loss of detail.  Especially with the ability to include splines connecting specific vertices for highlighting trajectories. <\/p>\n<pre><code class='r'>\r\nlibrary(ndtv)\r\ndata(toy_epi_sim)  \r\ntimePrism(toy_epi_sim,\r\n           orientation=c('z','y','x'), # swap axes\r\n           angle=40,\r\n           spline.v=c(7, 29, 36, 70, 82, 96),  # hilite the infected \r\n           spline.col='red',\r\n           spline.lwd=2,\r\n           box=FALSE,\r\n           planes=TRUE,  # draw a semi-transparent 'plane' under each net\r\n           vertex.col='ndtvcol'  # use pre-created infection color scheme)\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/timePrism.jpeg\" alt=\"timePrism\" width=\"500\" height=\"500\" class=\"aligncenter size-full wp-image-778\" srcset=\"https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/timePrism.jpeg 500w, https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/timePrism-150x150.jpeg 150w, https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/timePrism-450x450.jpeg 450w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><br \/>\n<!--more--><\/p>\n<p>If you look really closely, you can see that it isn&#8217;t really 3D (some of objects and transparency are layered in the wrong order) but my goal was to make it use existing <code>plot.network<\/code> and <code>compute.animation<\/code> commands as much as possible so that arguments can be reused across the plot techniques. <\/p>\n<h2>Get widgety with it<\/h2>\n<p>Perhaps the most useful update (other than the bug fixes) is that <code>render.d3movie<\/code> now has an <code>output.mode='htmlWidget'<\/code> option to export the <a href=\"http:\/\/skyeome.net\/wordpress\/?p=737\">HTML5 animation<\/a> as an <a href=\"http:\/\/www.htmlwidgets.org\/\">htmlwidget<\/a> for viewing in RStudio (with play controls and interactivity!) or as a Shiny app.  So it should be even easier to include interactive network diagrams in reports and web pages.  In fact, <a href=\"http:\/\/samueljenness.org\/\">Sam Jenness<\/a> points out that &#8220;&#8230;this now interfaces with Rstudio&#8217;s Rpubs website, so it&#8217;s a one-button quick publishing approach for these movies: <a href=\"http:\/\/rpubs.com\/smjenness\/116671\">http:\/\/rpubs.com\/smjenness\/116671<\/a>&#8221;<\/p>\n<h2>A new view for trees<\/h2>\n<p>A feature I&#8217;m excited about developing further is the <code>transmissionTimeline<\/code> plot to illustrate a spreading tree from a source vertex in a network (also based on a conversation with Sam).  This works to plot the forward-reachable <code>tPath<\/code> found by the <a href=\"http:\/\/skyeome.net\/wordpress\/?p=763\">tsna<\/a> package (or other tree-like edgelists), and will soon be an optional display for exploring infection trees in <a href=\"http:\/\/www.epimodel.org\/\">EpiModel<\/a>.  The idea is to show the who-infected-whom tree of relationships by positioning vertices according their infection time (on the horizontal axis) and their transmission generation (on the vertical).  This puts the source vertex at the origin (lower left) and all of the infection chains as trails arcing out to the right.  <\/p>\n<pre><code class='r'>\r\nlibrary(ndtv)\r\nlibrary(tsna)\r\ndata(\"moodyContactSim\")\r\n# extract the forward path from vertex 10\r\nv10path< -tPath(moodyContactSim,v=10)\r\ntransmissionTimeline(v10path)\r\n<\/code><\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/transmissionTimeline.jpeg\" alt=\"transmissionTimeline\" width=\"500\" height=\"500\" class=\"aligncenter size-full wp-image-780\" srcset=\"https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/transmissionTimeline.jpeg 500w, https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/transmissionTimeline-150x150.jpeg 150w, https:\/\/skyeome.net\/wordpress\/wp-content\/uploads\/2015\/10\/transmissionTimeline-450x450.jpeg 450w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>Obviously I&#8217;ve chosen an example that looks nice, but the technique seems to be surprisingly useful in illustrating bursty-ness and reproduction rates (more on that later I hope).<\/p>\n<h2>FX<\/h2>\n<p>A final feature of note &#8212; functional but still preliminary &#8212; is the inclusion of some pre-built &#8220;special effects&#8221; functions for animation rendering.  i.e. color edges by their age.  See the help page <code>?effects<\/code> for details. <\/p>\n<p>I&#8217;m incrementally updating the <a href=\"http:\/\/statnet.csde.washington.edu\/workshops\/SUNBELT\/current\/ndtv\/ndtv_workshop.html\">html version of the ndtv tutorial<\/a>, which I was unable to present in July.  (May have to abandon the pdf version, as pandoc goes berserk when I try to render)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>..and continuing in the thread of long-overdue R package updates, we&#8217;ve got a new ndtv version out as well. Peek into the time prism The package release adds some &#8220;whiteboard candy&#8221;: 2.5D orthogonal projection of networks in time along a z axis. For lack of a better name, I&#8217;ve dubbed it a timePrism (let me &hellip; <a href=\"https:\/\/skyeome.net\/wordpress\/?p=775\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">new ndtv release: 0.7<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,14,19,21],"tags":[],"_links":{"self":[{"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/775"}],"collection":[{"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=775"}],"version-history":[{"count":13,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/775\/revisions"}],"predecessor-version":[{"id":790,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/775\/revisions\/790"}],"wp:attachment":[{"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skyeome.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}