{"id":929,"date":"2011-06-14T11:35:50","date_gmt":"2011-06-14T15:35:50","guid":{"rendered":"http:\/\/www.nomad.priv.at\/researchblog\/?p=929"},"modified":"2011-06-14T11:35:50","modified_gmt":"2011-06-14T15:35:50","slug":"boxplots-without-boxes","status":"publish","type":"post","link":"http:\/\/www.nomad.priv.at\/researchblog\/?p=929","title":{"rendered":"Boxplots without boxes"},"content":{"rendered":"<p>Let&#8217;s say you have several categories with multiple data points each that you would like to plot as individual points. Even if you have only a single point, the <a href=\"http:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/graphics\/html\/00Index.html\">R graphics package<\/a> will plot a line (without a box for lack of data). Overriding the default setting with e.g.\u00a0pch = 1 does not help.<\/p>\n<p>R&#8217;s <a href=\"http:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/graphics\/html\/boxplot.html\"><code>boxplot<\/code><\/a> function (or the\u00a0<a href=\"http:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/graphics\/html\/plot.html\"><code>plot<\/code><\/a> function for that matter) &#8211; correctly &#8211; generates a boxplot for each category. If you would like to see individual points instead of boxes, the following code snippet could help by using the <a href=\"http:\/\/stat.ethz.ch\/R-manual\/R-patched\/library\/graphics\/html\/points.html\"><code>points<\/code><\/a> function:<\/p>\n<p># Plot the boxplot as usual, but in white colour to make the boxes invisible, but keep the axes.<br \/>\n<code><br \/>\nboxplot(m$var ~ m$cat, xlab = \"Category\", ylab = \"Variable\", border = \"white\")<\/code><\/p>\n<p># Plot the data again into the same plot and customise the point shape, etc to your liking<br \/>\n<code><br \/>\npoints(m$var ~ m$cat, pch = 1)<br \/>\n<\/code><\/p>\n<p>Voila!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s say you have several categories with multiple data points each that you would like to plot as individual points. Even if you have only a single point, the R graphics package will plot a line (without a box for lack of data). Overriding the default setting with e.g.\u00a0pch = 1 does not help. R&#8217;s &hellip; <a href=\"http:\/\/www.nomad.priv.at\/researchblog\/?p=929\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Boxplots without boxes<\/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":[6,4],"tags":[54,277,278,511],"class_list":["post-929","post","type-post","status-publish","format-standard","hentry","category-r","category-research","tag-boxplot","tag-plot","tag-points","tag-r"],"_links":{"self":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=929"}],"version-history":[{"count":0,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/929\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=929"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}