{"id":1755,"date":"2010-07-01T23:07:19","date_gmt":"2010-07-01T22:07:19","guid":{"rendered":"http:\/\/www.decisionsciencenews.com\/?p=1755"},"modified":"2010-07-01T23:33:05","modified_gmt":"2010-07-01T22:33:05","slug":"maps-without-map-packages","status":"publish","type":"post","link":"https:\/\/www.decisionsciencenews.com\/?p=1755","title":{"rendered":"Maps without map packages"},"content":{"rendered":"<p>LATITUDE + LONGITUDE + OVERPLOTTING FIX = MAPS<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/usIPs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1757\" title=\"usIPs\" src=\"http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/usIPs.png\" alt=\"\" width=\"450\" height=\"393\" srcset=\"https:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/usIPs.png 450w, https:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/usIPs-300x262.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p>Decision Science News is always learning stuff from colleague, physicist, mathlete, and all-around computer whiz <a href=\"http:\/\/www.jakehofman.com\/\">Jake Hofman<\/a>.<\/p>\n<p>Today, it was a quick and clean way to make nice maps in <a href=\"http:\/\/www.r-project.org\/\">R<\/a> without using any map packages: just plot the latitude and longitude of your data points (e.g. web site visitors) along with the &#8220;alpha&#8221; parameter to allow for layering of coincident points. It&#8217;s duh in hindsight.<\/p>\n<p>Above we see a how it looks with a little data. Below is the result with more data and a lower alpha:<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/uswtIPs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-1756       aligncenter\" title=\"uswtIPs\" src=\"http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/uswtIPs.png\" alt=\"\" width=\"446\" height=\"323\" srcset=\"https:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/uswtIPs.png 446w, https:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/uswtIPs-300x217.png 300w\" sizes=\"auto, (max-width: 446px) 100vw, 446px\" \/><\/a><\/p>\n<p>In the words of James Taylor, all you have to do is call:<\/p>\n<blockquote><p>library(ggplot2)<br \/>\nqplot(long,lat,data=us,alpha=I(.1))<\/p><\/blockquote>\n<p>To get the Decision-Science-News-approved framing and aspect ratio for the USA:<\/p>\n<blockquote><p>qplot(long,lat,data=wtd,alpha=I(.1),<br \/>\nxlim=c(-125-10\/2,-65),ylim=c(23.5,50.5)) +<br \/>\nopts(aspect.ratio = 3.5\/5)<\/p><\/blockquote>\n<p>As we are certain that there are readers who will want to show that there are much nicer ways to do this, we say: <a href='http:\/\/www.decisionsciencenews.com\/wp-content\/uploads\/2010\/07\/latlong.zip'>download the data and show us<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LATITUDE + LONGITUDE + OVERPLOTTING FIX = MAPS Decision Science News is always learning stuff from colleague, physicist, mathlete, and all-around computer whiz Jake Hofman. Today, it was a quick and clean way to make nice maps in R without using any map packages: just plot the latitude and longitude of your data points (e.g. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[16,74],"tags":[109,105,107,103,102,104,106,1208,108,70,101],"class_list":["post-1755","post","type-post","status-publish","format-standard","hentry","category-ideas","category-r","tag-aspect-ratio","tag-drawing","tag-ggplot2","tag-graphics","tag-graphing","tag-maps","tag-plotting","tag-r","tag-scaling","tag-statistics","tag-stats"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4LKj-sj","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/1755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1755"}],"version-history":[{"count":13,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/1755\/revisions"}],"predecessor-version":[{"id":1771,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=\/wp\/v2\/posts\/1755\/revisions\/1771"}],"wp:attachment":[{"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.decisionsciencenews.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}