{"id":364,"date":"2013-03-06T16:09:08","date_gmt":"2013-03-06T16:09:08","guid":{"rendered":"http:\/\/blopig.com\/blog\/?p=364"},"modified":"2013-03-06T16:10:57","modified_gmt":"2013-03-06T16:10:57","slug":"on-being-cool-arrows-on-an-r-plot","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2013\/03\/on-being-cool-arrows-on-an-r-plot\/","title":{"rendered":"On being cool: arrows on an R plot"},"content":{"rendered":"<p>Recently I needed a schematic graph of traditional vs on-demand computing (don&#8217;t ask) &#8211; and in this hand waving setting I just wanted the axes to show arrows and no labels. \u00a0So, here it is:<\/p>\n<pre class=\"toolbar:2 wrap:true plain:false plain-toggle:false lang:r decode:true\" title=\"R plot with arrows for axes\">x &lt;- c(1:5)\r\ny &lt;- rnorm(5)\r\nplot(x, y, axes = FALSE)\r\nu &lt;- par(\"usr\") \r\narrows(u[1], u[3], u[2], u[3], code = 2, xpd = TRUE) \r\narrows(u[1], u[3], u[1], u[4], code = 2, xpd = TRUE)<\/pre>\n<p>And here is the output<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/blopig.com\/blog\/wp-content\/uploads\/2013\/03\/test.png\"><img data-recalc-dims=\"1\" decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-366\" alt=\"Arrowed plot\" src=\"https:\/\/i0.wp.com\/blopig.com\/blog\/wp-content\/uploads\/2013\/03\/test-300x300.png?resize=300%2C300\" width=\"300\" height=\"300\" srcset=\"https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2013\/03\/test.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2013\/03\/test.png?resize=150%2C150&amp;ssl=1 150w, https:\/\/i0.wp.com\/www.blopig.com\/blog\/wp-content\/uploads\/2013\/03\/test.png?w=480&amp;ssl=1 480w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>(I pinched this off a mailing list post, so this is my due <a href=\"http:\/\/tolstoy.newcastle.edu.au\/R\/help\/04\/10\/5856.html\">reference<\/a>)<\/p>\n<p>Next thing I am toying with are these <a title=\"xkcd.com ~ great web comics\" href=\"http:\/\/xkcd.com\/\" target=\"_blank\">xkcd<\/a> like graphs in R <a title=\"xkcd like graphs\" href=\"http:\/\/stackoverflow.com\/questions\/12675147\/how-can-we-make-xkcd-style-graphs-in-r\" target=\"_blank\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I needed a schematic graph of traditional vs on-demand computing (don&#8217;t ask) &#8211; and in this hand waving setting I just wanted the axes to show arrows and no labels. \u00a0So, here it is: x &lt;- c(1:5) y &lt;- rnorm(5) plot(x, y, axes = FALSE) u &lt;- par(&#8220;usr&#8221;) arrows(u[1], u[3], u[2], u[3], code = [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14,15],"tags":[],"ppma_author":[483],"class_list":["post-364","post","type-post","status-publish","format-standard","hentry","category-howto","category-technical"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":483,"user_id":6,"is_guest":0,"slug":"jp","display_name":"JP Ebejer","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/0c2ee7f7a071e0ff6aebc09ddb6c7bdd90146efeb8dfac34f7724f0b04ceafe8?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/364","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=364"}],"version-history":[{"count":5,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/364\/revisions"}],"predecessor-version":[{"id":370,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/364\/revisions\/370"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=364"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}