{"id":2246,"date":"2019-06-10T06:30:15","date_gmt":"2019-06-10T06:30:15","guid":{"rendered":"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/10\/interesting-type-of-chart-hexagonal-binning\/"},"modified":"2019-06-10T06:30:15","modified_gmt":"2019-06-10T06:30:15","slug":"interesting-type-of-chart-hexagonal-binning","status":"publish","type":"post","link":"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/10\/interesting-type-of-chart-hexagonal-binning\/","title":{"rendered":"Interesting Type of Chart: Hexagonal Binning"},"content":{"rendered":"<p>Author: Capri Granville<\/p>\n<div>\n<p>This chart communicates the same insights as a contour plot. What is interesting is the choice of hexagonal buckets (rather than squares) to aggregate data. In fact, any <a href=\"https:\/\/www.google.com\/search?q=tessellation&#038;biw=1255&#038;bih=668&#038;source=lnms&#038;tbm=isch&#038;sa=X\" target=\"_blank\" rel=\"noopener noreferrer\">tessellation<\/a> would work, in particular <a href=\"http:\/\/mathworld.wolfram.com\/VoronoiDiagram.html\" target=\"_blank\" rel=\"noopener noreferrer\">Voronoi tessellations<\/a>.<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855422186?profile=original\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855422186?profile=RESIZE_710x\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><em>3-D Voronoi tessellation\u00a0<\/em><\/p>\n<p>The reason for using hexagons is that it is still pretty simple, and when you rotate the chart by 60 degrees (or a multiple of 60 degrees) you still get the same visualization.\u00a0 For squares, rotations of 60 degrees don&#8217;t work, only multiples of 90 degrees work. Is it possible to find a tessellation such that smaller rotations, say 45 or 30 degrees, leave the chart unchanged? The answer is no. <a href=\"https:\/\/www.google.com\/search?q=octagonal+tessellation\" target=\"_blank\" rel=\"noopener noreferrer\">Octogonal tessellations<\/a> don&#8217;t really exist, so the hexagon is an optimum.\u00a0<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855432732?profile=original\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855432732?profile=RESIZE_710x\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><em>Hexagonal binning plots (source: <a href=\"https:\/\/datavizproject.com\/data-type\/hexagonal-binning\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>)<\/em><\/p>\n<p><strong>Implementation in R<\/strong><\/p>\n<p>The three plots described here (Voronoi diagram, hexagonal binning and contour plots) are available in the ggplot2 package.<\/p>\n<ul>\n<li>Hexagonal binning: ggplot function with the parameter stat_binhex, see <a href=\"https:\/\/ggplot2.tidyverse.org\/reference\/geom_hex.html\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a><\/li>\n<li>Contour plot: ggplot function with the parameters geom_density2 or stat_contour, see <a href=\"https:\/\/www.r-statistics.com\/2016\/07\/using-2d-contour-plots-within-ggplot2-to-visualize-relationships-between-three-variables\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> \u00a0(also works with <a href=\"https:\/\/stat.ethz.ch\/R-manual\/R-devel\/library\/graphics\/html\/contour.html\" target=\"_blank\" rel=\"noopener noreferrer\">contour<\/a>)<\/li>\n<li>Voronoi diagram: ggplot with the parameter geom_segment, see <a href=\"https:\/\/letstalkdata.com\/2014\/05\/creating-voronoi-diagrams-with-ggplot\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a><\/li>\n<\/ul>\n<p><strong>Applications<\/strong><\/p>\n<p>Voronoi diagrams can be used for nearest neighbor clustering or density estimation, the density estimate attached to a point being proportional to the inverse of the area of the Voronoi polygon containing it.<\/p>\n<\/p>\n<p><a href=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855467134?profile=original\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/storage.ning.com\/topology\/rest\/1.0\/file\/get\/2855467134?profile=RESIZE_710x\" class=\"align-center\"><\/a><\/p>\n<p style=\"text-align: center;\"><em>Example of contour map (source: <a href=\"https:\/\/www.datasciencecentral.com\/profiles\/blogs\/building-outiler-resistant-centroids-in-any-dimension\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>)<\/em><\/p>\n<\/div>\n<p><a href=\"https:\/\/www.datasciencecentral.com\/xn\/detail\/6448529:BlogPost:836038\">Go to Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Capri Granville This chart communicates the same insights as a contour plot. What is interesting is the choice of hexagonal buckets (rather than squares) [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/www.aiproblog.com\/index.php\/2019\/06\/10\/interesting-type-of-chart-hexagonal-binning\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":467,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/2246"}],"collection":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=2246"}],"version-history":[{"count":0,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/2246\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media\/462"}],"wp:attachment":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=2246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=2246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=2246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}