<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Maps on zachcp</title>
		<link>http://zachcp.org/categories/maps/</link>
		<description>Recent content in Maps on zachcp</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
			<copyright>© 2007- {year}</copyright>
		
		
			<lastBuildDate>Mon, 16 May 2016 08:03:00 +0000</lastBuildDate>
		
			<atom:link href="http://zachcp.org/categories/maps/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>plotting images by extending ggplot</title>
				<link>http://zachcp.org/blog/geom_image_repel/</link>
				<pubDate>Mon, 16 May 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/geom_image_repel/</guid>
				<description>&lt;p&gt;As a followup to a recent post on the use of &lt;a href=&#34;http://zachcp.org/blog/2016/ggrepelmaps/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ggrepel&amp;rsquo;s placement code&lt;/a&gt; to&#xA;place images on maps, I wanted to do a better job of hooking into ggplot&amp;rsquo;s extensibility mechanism. In order to benefit from ggplot&amp;rsquo;s handling of variables I really wanted to have a column where I could add ggplot object. Then my imageGrobs could be passed around like any other value. That is not possible. However, it is possible to use&#xA;strings corresponding to image file locations. How hard would it be to modify the excellent &lt;a href=&#34;https://github.com/slowkow/ggrepel&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ggrepel&lt;/a&gt; package to support handling of images? Fortunately, as Kamil has done all of the hard work, the answer is: not very. Below I outline the basic workings of a ggplot &lt;strong&gt;geom&lt;/strong&gt; that lets you use filenames to plot PNGs into your ggplot. Gist of the code is &lt;a href=&#34;https://gist.github.com/zachcp/a82c017e52627bb2ab4651968bddf77e&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;here&lt;/a&gt;. To use this code you will need the geom_point_repel branch of my &lt;a href=&#34;https://github.com/zachcp/ggrepel&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ggrepel fork&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>ggrepel with maps</title>
				<link>http://zachcp.org/blog/ggrepelmaps/</link>
				<pubDate>Tue, 01 Mar 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/ggrepelmaps/</guid>
				<description>&lt;p&gt;&lt;a href=&#34;https://github.com/slowkow/ggrepel&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ggrepel&lt;/a&gt; is a package for R that build on ggplot an uses the&#xA;new ggproto OO system for extending ggplot to provide a few new geom&amp;rsquo;s for placing text and labels. Its great.&#xA;I&amp;rsquo;ve been working on some maps and was hoping I could take the same principles used in ggrepel&#xA;to add images to a ggplot. In short, I couldn&amp;rsquo;t find a way that would let you use the ggproto&#xA;system (unless there is a way to store grobs within data.frames that I don&amp;rsquo;t know about) but&#xA;you can call ggrepel directly to find non-overlapping points for arbitrary boxes, and you can&#xA;add plots, images etc to a grid grapchic using the &lt;strong&gt;annotation_custom&lt;/strong&gt; function of ggplot.&lt;/p&gt;</description>
			</item>
			<item>
				<title>NYC Boundary Maps</title>
				<link>http://zachcp.org/blog/nyc_borough_boundaries/</link>
				<pubDate>Mon, 01 Feb 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/nyc_borough_boundaries/</guid>
				<description>&lt;p&gt;I created an R package to load NYC Borough boundaries that is available on &lt;a href=&#34;https://github.com/zachcp/nycmaps&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;github&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code class=&#34;language-{r}&#34;&gt;#load and use the map&#xA;devtools::install_github(&amp;quot;zachcp/nycmaps&amp;quot;)&#xA;libary(nycmaps)&#xA;library(maps)&#xA;map(database=&amp;quot;nyc&amp;quot;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;img src=&#34;http://zachcp.org/pics/blog/2016/nyc_boroughs.png&#34; width=500&gt;&#xA;&lt;h2 id=&#34;a-few-notes&#34;&gt;A few notes&lt;a class=&#34;anchor&#34; href=&#34;#a-few-notes&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;check the &lt;code&gt;data-raw&lt;/code&gt; directory for a Makefile on Downloading and converting the geojson into the R-binary format&lt;/li&gt;&#xA;&lt;li&gt;Most regions/islands have been names but I may be missing some.&lt;/li&gt;&#xA;&lt;li&gt;Many of the Jamaica Bay Islands are not included (I took them all out and then added back the big ones around Cross Bay Boulevard)&lt;/li&gt;&#xA;&lt;li&gt;when loading this sets a /GlobalEnd defining where the map files live. To be incorporated in &lt;code&gt;Maps&lt;/code&gt; or included in CRAN this is a no-no but I don&amp;rsquo;t a better way.&lt;/li&gt;&#xA;&lt;/ol&gt;</description>
			</item>
			<item>
				<title>Small Multiples Map</title>
				<link>http://zachcp.org/blog/small-multiples-map/</link>
				<pubDate>Sun, 17 Jan 2016 08:03:00 +0000</pubDate>
				<guid>http://zachcp.org/blog/small-multiples-map/</guid>
				<description>&lt;p&gt;Despite using R and its various graphing facilities I have somehow managed not to have stumbled across&#xA;&lt;a href=&#34;http://rud.is/b/about/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Bob&lt;/a&gt; &lt;a href=&#34;https://twitter.com/hrbrmstr&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Rudis&lt;/a&gt;. I recently noticed his &lt;a href=&#34;https://cran.r-project.org/web/packages/ggalt/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;ggalt&lt;/a&gt; package which has some similarities overlap to stuff I have tried to do in &lt;a href=&#34;https://github.com/zachcp/phylogeo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;phylogeo&lt;/a&gt;.  This inspired me to give a quick whirl to the small-multiples style of charts, of which the following is a small, reproducible example. When put into combination with the updated projections and higher-res mapdata of the [maps package] (&lt;a href=&#34;https://cran.r-project.org/web/packages/maps/README.html&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;https://cran.r-project.org/web/packages/maps/README.html&lt;/a&gt;): (natural earth 1:50m.)&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
