Data on tour: Plotting 3D maps and location tracks

[This article was first published on Shirin's playgRound, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Recently, I was on Gran Canaria for a vacation. So, what better way to keep up the holiday spirit a while longer than to visualize all the places we went in R!?

I am combining location data collected by

  1. our car GPS,
  2. Google location data from my phone and
  3. the hiking tracks we followed.

Obviously, the data itself is not public this time but the principles for plotting can be used with any .gpx files that cointain latitude, longitude and elevation data.

Gran Canaria

Gran Canaria is one of the Spanish Canary Islands off the coast of Morocco. As its sister islands, it is of volcanic origin.



Car GPS tracks

The GPS tracks in .gpx format were downloaded from the device (Garmin) the same way as I had already done with the tracks from our US/Canada roadtrip last year. Garmin’s .gpx tracks are not in a standard format that could be read with readGPX(), so I had to use htmlTreeParse() from the XML library.

<span class="n">library</span><span class="p">(</span><span class="n">XML</span><span class="p">)</span><span class="w">

</span><span class="c1"># list of files in directory
</span><span class="n">myfiles</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">list.files</span><span class="p">(</span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Takeout_2017_March"</span><span class="p">,</span><span class="w"> </span><span class="n">full.names</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">

</span><span class="c1"># all gpx files in that directory
</span><span class="n">myfiles</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">myfiles</span><span class="p">[</span><span class="n">grep</span><span class="p">(</span><span class="s2">".gpx"</span><span class="p">,</span><span class="w"> </span><span class="n">myfiles</span><span class="p">)]</span><span class="w">

</span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="nf">length</span><span class="p">(</span><span class="n">myfiles</span><span class="p">))</span><span class="w"> </span><span class="p">{</span><span class="w">

    </span><span class="c1"># parse document
</span><span class="w">    </span><span class="n">pfile</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">htmlTreeParse</span><span class="p">(</span><span class="n">myfiles</span><span class="p">[</span><span class="n">i</span><span class="p">],</span><span class="w"> </span><span class="n">useInternalNodes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">T</span><span class="p">)</span><span class="w">
  
    </span><span class="c1"># Get all elevations, times and coordinates via the respective xpath
</span><span class="w">    </span><span class="n">elevations</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.numeric</span><span class="p">(</span><span class="nf">as.character</span><span class="p">(</span><span class="n">xpathSApply</span><span class="p">(</span><span class="n">pfile</span><span class="p">,</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"//trkpt/ele"</span><span class="p">,</span><span class="w"> </span><span class="n">xmlValue</span><span class="p">)))</span><span class="w">
    </span><span class="n">times</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">xpathSApply</span><span class="p">(</span><span class="n">pfile</span><span class="p">,</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"//trkpt/time"</span><span class="p">,</span><span class="w"> </span><span class="n">xmlValue</span><span class="p">)</span><span class="w">
    </span><span class="n">coords</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">xpathSApply</span><span class="p">(</span><span class="n">pfile</span><span class="p">,</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"//trkpt"</span><span class="p">,</span><span class="w"> </span><span class="n">xmlAttrs</span><span class="p">)</span><span class="w">
    
    </span><span class="c1"># Extract latitude and longitude from the coordinates
</span><span class="w">    </span><span class="n">lats</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.numeric</span><span class="p">(</span><span class="nf">as.character</span><span class="p">(</span><span class="n">coords</span><span class="p">[</span><span class="s2">"lat"</span><span class="p">,]))</span><span class="w">
    </span><span class="n">lons</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.numeric</span><span class="p">(</span><span class="nf">as.character</span><span class="p">(</span><span class="n">coords</span><span class="p">[</span><span class="s2">"lon"</span><span class="p">,]))</span><span class="w">
    
    </span><span class="c1"># Put everything in a dataframe
</span><span class="w">    </span><span class="n">geodf</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">data.frame</span><span class="p">(</span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lats</span><span class="p">,</span><span class="w"> </span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lons</span><span class="p">,</span><span class="w"> </span><span class="n">ele</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">elevations</span><span class="p">,</span><span class="w"> </span><span class="n">time</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">times</span><span class="p">)</span><span class="w">

    </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="m">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="n">geodata</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">geodf</span><span class="w">
      </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="n">geodata</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">rbind</span><span class="p">(</span><span class="n">geodata</span><span class="p">,</span><span class="w"> </span><span class="n">geodf</span><span class="p">)</span><span class="w">
    </span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">

</span><span class="n">geodata_all</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">geodata</span><span class="w">

</span><span class="c1"># Transforming the time column
</span><span class="n">geodata_all</span><span class="o">$</span><span class="n">time</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.character</span><span class="p">(</span><span class="n">strptime</span><span class="p">(</span><span class="n">geodata_all</span><span class="o">$</span><span class="n">time</span><span class="p">,</span><span class="w"> </span><span class="n">format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"%Y-%m-%dT%H:%M:%SZ"</span><span class="p">))</span><span class="w">

</span><span class="c1"># ordering by date
</span><span class="n">library</span><span class="p">(</span><span class="n">dplyr</span><span class="p">)</span><span class="w">
</span><span class="n">geodata_all</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">arrange</span><span class="p">(</span><span class="n">geodata_all</span><span class="p">,</span><span class="w"> </span><span class="n">time</span><span class="p">)</span><span class="w">

</span><span class="c1"># keep only data points from Gran Canaria
</span><span class="n">geodata_gc</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">geodata_all</span><span class="p">,</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="m">28.5</span><span class="w"> </span><span class="o">&</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="m">27.5</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">filter</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="m">-16</span><span class="w"> </span><span class="o">&</span><span class="w"> </span><span class="n">lon</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="m">-15</span><span class="p">)</span><span class="w">
</span>

Hiking tracks

The hiking tracks we followed came mostly from a German hiking guide-book, the Rother Wanderführer, 7th edition from 2016. They were in standard .gpx format and could be read with readGPX().

Only one of our hikes did not come from this book, but from Wikiloc. It could be treated the same way as the other hiking tracks, though, so I combined all hiking tracks.

<span class="n">library</span><span class="p">(</span><span class="n">plotKML</span><span class="p">)</span><span class="w">

</span><span class="c1"># get file names
</span><span class="n">myfiles</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">list.files</span><span class="p">(</span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"hiking"</span><span class="p">,</span><span class="w"> </span><span class="n">full.names</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">myfiles</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">myfiles</span><span class="p">[</span><span class="n">grep</span><span class="p">(</span><span class="s2">".gpx"</span><span class="p">,</span><span class="w"> </span><span class="n">myfiles</span><span class="p">)]</span><span class="w">

</span><span class="k">for</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="m">1</span><span class="o">:</span><span class="nf">length</span><span class="p">(</span><span class="n">myfiles</span><span class="p">))</span><span class="w"> </span><span class="p">{</span><span class="w">

  </span><span class="c1"># read in gpx files
</span><span class="w">  </span><span class="n">t</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">readGPX</span><span class="p">(</span><span class="n">myfiles</span><span class="p">[</span><span class="n">i</span><span class="p">])</span><span class="w">
  
  </span><span class="c1"># extract latitude, longitude and elevation
</span><span class="w">  </span><span class="n">geodf</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">data.frame</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">t</span><span class="o">$</span><span class="n">tracks</span><span class="p">[[</span><span class="m">1</span><span class="p">]][[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w">
                      </span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">t</span><span class="o">$</span><span class="n">tracks</span><span class="p">[[</span><span class="m">1</span><span class="p">]][[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">lat</span><span class="p">,</span><span class="w">
                      </span><span class="n">ele</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">t</span><span class="o">$</span><span class="n">tracks</span><span class="p">[[</span><span class="m">1</span><span class="p">]][[</span><span class="m">1</span><span class="p">]]</span><span class="o">$</span><span class="n">ele</span><span class="p">,</span><span class="w">
                      </span><span class="n">tour</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">names</span><span class="p">(</span><span class="n">t</span><span class="o">$</span><span class="n">tracks</span><span class="p">[[</span><span class="m">1</span><span class="p">]]))</span><span class="w">

    </span><span class="c1"># combine into data frame
</span><span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">i</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="m">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="n">geodata</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">geodf</span><span class="w">
      </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="n">geodata</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">rbind</span><span class="p">(</span><span class="n">geodata</span><span class="p">,</span><span class="w"> </span><span class="n">geodf</span><span class="p">)</span><span class="w">
    </span><span class="p">}</span><span class="w">
  </span><span class="n">rm</span><span class="p">(</span><span class="n">pfile</span><span class="p">)</span><span class="w">
</span><span class="p">}</span><span class="w">

</span><span class="n">geodata_tracks</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">geodata</span><span class="w">
</span>

Google location history

The Google location data from my phone were prepared the same way as in my post about plotting your Google location history.

<span class="n">library</span><span class="p">(</span><span class="n">jsonlite</span><span class="p">)</span><span class="w">
</span><span class="n">system.time</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">fromJSON</span><span class="p">(</span><span class="s2">"Standortverlauf.json"</span><span class="p">))</span><span class="w">
</span>
<span class="c1"># extracting the locations dataframe
</span><span class="n">loc</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">x</span><span class="o">$</span><span class="n">locations</span><span class="w">

</span><span class="c1"># converting time column from posix milliseconds into a readable time scale
</span><span class="n">loc</span><span class="o">$</span><span class="n">time</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">as.POSIXct</span><span class="p">(</span><span class="nf">as.numeric</span><span class="p">(</span><span class="n">x</span><span class="o">$</span><span class="n">locations</span><span class="o">$</span><span class="n">timestampMs</span><span class="p">)</span><span class="o">/</span><span class="m">1000</span><span class="p">,</span><span class="w"> </span><span class="n">origin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"1970-01-01"</span><span class="p">)</span><span class="w">

</span><span class="c1"># converting longitude and latitude from E7 to GPS coordinates
</span><span class="n">loc</span><span class="o">$</span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">loc</span><span class="o">$</span><span class="n">latitudeE7</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="m">1e7</span><span class="w">
</span><span class="n">loc</span><span class="o">$</span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">loc</span><span class="o">$</span><span class="n">longitudeE7</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="m">1e7</span><span class="w">

</span><span class="c1"># keep only data from Gran Canaria
</span><span class="n">loc_gc</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">filter</span><span class="p">(</span><span class="n">loc</span><span class="p">,</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="m">28.5</span><span class="w"> </span><span class="o">&</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="m">27.5</span><span class="p">)</span><span class="w"> </span><span class="o">%>%</span><span class="w">
  </span><span class="n">filter</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="m">-16</span><span class="w"> </span><span class="o">&</span><span class="w"> </span><span class="n">lon</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="m">-15</span><span class="p">)</span><span class="w">
</span>

All three datasets had information about the latitude/longitude coordinate pairs and of the elevation of each observation, so I can combine these three attributes from the three location data sources.

<span class="n">geodata_tracks</span><span class="o">$</span><span class="n">ele</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">as.numeric</span><span class="p">(</span><span class="nf">as.character</span><span class="p">(</span><span class="n">geodata_tracks</span><span class="o">$</span><span class="n">ele</span><span class="p">))</span><span class="w">
</span><span class="n">data_combined</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">data.frame</span><span class="p">(</span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="n">geodata_gc</span><span class="o">$</span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">loc_gc</span><span class="o">$</span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">geodata_tracks</span><span class="o">$</span><span class="n">lat</span><span class="p">),</span><span class="w">
                            </span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="n">geodata_gc</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">loc_gc</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">geodata_tracks</span><span class="o">$</span><span class="n">lon</span><span class="p">),</span><span class="w">
                            </span><span class="n">ele</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="n">geodata_gc</span><span class="o">$</span><span class="n">ele</span><span class="p">,</span><span class="w"> </span><span class="n">loc_gc</span><span class="o">$</span><span class="n">altitude</span><span class="p">,</span><span class="w"> </span><span class="n">geodata_tracks</span><span class="o">$</span><span class="n">ele</span><span class="p">),</span><span class="w">
                            </span><span class="n">track</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nf">c</span><span class="p">(</span><span class="nf">rep</span><span class="p">(</span><span class="s2">"GPS"</span><span class="p">,</span><span class="w"> </span><span class="n">nrow</span><span class="p">(</span><span class="n">geodata_gc</span><span class="p">)),</span><span class="w"> </span><span class="nf">rep</span><span class="p">(</span><span class="s2">"Google"</span><span class="p">,</span><span class="w"> </span><span class="n">nrow</span><span class="p">(</span><span class="n">loc_gc</span><span class="p">)),</span><span class="w"> </span><span class="nf">rep</span><span class="p">(</span><span class="s2">"Hiking"</span><span class="p">,</span><span class="w"> </span><span class="n">nrow</span><span class="p">(</span><span class="n">geodata_tracks</span><span class="p">))))</span><span class="w">
</span><span class="n">data_combined</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">data_combined</span><span class="p">[</span><span class="o">!</span><span class="n">duplicated</span><span class="p">(</span><span class="n">data_combined</span><span class="p">),</span><span class="w"> </span><span class="p">]</span><span class="w">
</span>

Elevation profile

I downloaded the elevation profile of Gran Canaria with the maptools and raster packages.

<span class="n">library</span><span class="p">(</span><span class="n">maptools</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">raster</span><span class="p">)</span><span class="w">
</span><span class="n">srtm</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">getData</span><span class="p">(</span><span class="s2">"SRTM"</span><span class="p">,</span><span class="w"> </span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">-15.59972</span><span class="p">,</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">27.965</span><span class="p">)</span><span class="w">

</span><span class="c1"># crop to Gran Canaria & Tenerife
</span><span class="n">e</span><span class="m">1</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">extent</span><span class="p">(</span><span class="nf">min</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="m">1.2</span><span class="p">,</span><span class="w"> </span><span class="c1"># xmin
</span><span class="w">            </span><span class="nf">max</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">0.1</span><span class="p">,</span><span class="w"> </span><span class="c1"># xmax
</span><span class="w">            </span><span class="nf">min</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="m">0.1</span><span class="p">,</span><span class="w"> </span><span class="c1"># ymin
</span><span class="w">            </span><span class="nf">max</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">0.5</span><span class="p">)</span><span class="w"> </span><span class="c1"># ymax
</span><span class="w">
</span><span class="n">srtm_ct</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">crop</span><span class="p">(</span><span class="n">srtm</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="m">1</span><span class="p">)</span><span class="w">

</span><span class="c1"># plot slope and aspect with hill shades
</span><span class="n">slope</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">terrain</span><span class="p">(</span><span class="n">srtm_ct</span><span class="p">,</span><span class="w"> </span><span class="n">opt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"slope"</span><span class="p">)</span><span class="w">
</span><span class="n">aspect</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">terrain</span><span class="p">(</span><span class="n">srtm_ct</span><span class="p">,</span><span class="w"> </span><span class="n">opt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"aspect"</span><span class="p">)</span><span class="w">
</span><span class="n">hill</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">hillShade</span><span class="p">(</span><span class="n">slope</span><span class="p">,</span><span class="w"> </span><span class="n">aspect</span><span class="p">,</span><span class="w"> </span><span class="n">angle</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">45</span><span class="p">,</span><span class="w"> </span><span class="n">direction</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">45</span><span class="p">,</span><span class="w"> </span><span class="n">normalize</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">plot</span><span class="p">(</span><span class="n">hill</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">grey</span><span class="p">(</span><span class="m">0</span><span class="o">:</span><span class="m">100</span><span class="o">/</span><span class="m">100</span><span class="p">),</span><span class="w"> </span><span class="n">legend</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">FALSE</span><span class="p">)</span><span class="w">
</span><span class="n">plot</span><span class="p">(</span><span class="n">srtm_ct</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rainbow</span><span class="p">(</span><span class="m">25</span><span class="p">,</span><span class="w"> </span><span class="n">alpha</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.35</span><span class="p">),</span><span class="w"> </span><span class="n">add</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span>

Its sister island to the west, Tenerife is a bit larger and, as can be seen in the image above, its highest point, the Teide, is about 1000 meters higher than Gran Canaria’s highest point.

<span class="c1"># crop to Gran Canaria
</span><span class="n">e</span><span class="m">2</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">extent</span><span class="p">(</span><span class="nf">min</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="m">0.2</span><span class="p">,</span><span class="w"> </span><span class="c1"># xmin
</span><span class="w">            </span><span class="nf">max</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">0.1</span><span class="p">,</span><span class="w"> </span><span class="c1"># xmax
</span><span class="w">            </span><span class="nf">min</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="m">0.1</span><span class="p">,</span><span class="w"> </span><span class="c1"># ymin
</span><span class="w">            </span><span class="nf">max</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="m">0.1</span><span class="p">)</span><span class="w"> </span><span class="c1"># ymax
</span><span class="w">
</span><span class="n">srtm_c</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">crop</span><span class="p">(</span><span class="n">srtm</span><span class="p">,</span><span class="w"> </span><span class="n">e</span><span class="m">2</span><span class="p">)</span><span class="w">

</span><span class="n">slope</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">terrain</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">opt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"slope"</span><span class="p">)</span><span class="w">
</span><span class="n">aspect</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">terrain</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">opt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"aspect"</span><span class="p">)</span><span class="w">
</span><span class="n">hill</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">hillShade</span><span class="p">(</span><span class="n">slope</span><span class="p">,</span><span class="w"> </span><span class="n">aspect</span><span class="p">,</span><span class="w"> </span><span class="n">angle</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">45</span><span class="p">,</span><span class="w"> </span><span class="n">direction</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">45</span><span class="p">,</span><span class="w"> </span><span class="n">normalize</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">plot</span><span class="p">(</span><span class="n">hill</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">grey</span><span class="p">(</span><span class="m">0</span><span class="o">:</span><span class="m">100</span><span class="o">/</span><span class="m">100</span><span class="p">),</span><span class="w"> </span><span class="n">legend</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">FALSE</span><span class="p">)</span><span class="w">
</span><span class="n">plot</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rainbow</span><span class="p">(</span><span class="m">25</span><span class="p">,</span><span class="w"> </span><span class="n">alpha</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.35</span><span class="p">),</span><span class="w"> </span><span class="n">add</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span>

Looking only at Gran Canaria’s slope and aspect profile, the plots nicely show its highest point (almost 2000 m) in the center of the island and that it slopes down towards sea level at the coast.

ggmap

I centered the map at the midpoint of Gran Canaria, which is given by http://www.travelmath.com/island/Gran+Canaria as 27° 57’ 54” N / 15° 35’ 59” W. Converted to decimal with http://www.rapidtables.com/convert/number/degrees-minutes-seconds-to-degrees.htm that is 27.965 & 15.59972.

<span class="n">library</span><span class="p">(</span><span class="n">ggplot2</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">ggmap</span><span class="p">)</span><span class="w">

</span><span class="n">map_theme</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="nf">list</span><span class="p">(</span><span class="n">theme</span><span class="p">(</span><span class="n">legend.position</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"top"</span><span class="p">,</span><span class="w">
                        </span><span class="n">panel.grid.minor</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">panel.grid.major</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">panel.background</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">plot.background</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_rect</span><span class="p">(</span><span class="n">fill</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"white"</span><span class="p">),</span><span class="w">
                        </span><span class="n">panel.border</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.line</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.text.x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.text.y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.ticks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.title.x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">axis.title.y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_blank</span><span class="p">(),</span><span class="w">
                        </span><span class="n">plot.title</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">element_text</span><span class="p">(</span><span class="n">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">18</span><span class="p">)))</span><span class="w">
</span>
<span class="n">map</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">get_map</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">-15.59972</span><span class="p">,</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">27.965</span><span class="p">),</span><span class="w"> </span><span class="n">zoom</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="n">maptype</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"terrain-background"</span><span class="p">,</span><span class="w"> </span><span class="n">source</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"google"</span><span class="p">)</span><span class="w">

</span><span class="n">ggmap</span><span class="p">(</span><span class="n">map</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> 
  </span><span class="n">geom_point</span><span class="p">(</span><span class="n">data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_combined</span><span class="p">,</span><span class="w"> </span><span class="n">aes</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">color</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">track</span><span class="p">),</span><span class="w"> </span><span class="n">alpha</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.3</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">scale_color_brewer</span><span class="p">(</span><span class="n">palette</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Set1"</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">map_theme</span><span class="w">
</span>

The above plot shows the different location data sources. Our car GPS recorded the most data points along our routes (blue), while Google location data (red) is only recorded occasionally (usually, when I turn on my phone, so it primarily shows places we walked around in). The hiking tracks in green show the 7 hikes we’ve followed.

<span class="n">map</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">get_map</span><span class="p">(</span><span class="nf">c</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">-15.59972</span><span class="p">,</span><span class="w"> </span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">27.965</span><span class="p">),</span><span class="w"> </span><span class="n">zoom</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">10</span><span class="p">)</span><span class="w">

</span><span class="n">ggmap</span><span class="p">(</span><span class="n">map</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> 
  </span><span class="n">geom_point</span><span class="p">(</span><span class="n">data</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">na.omit</span><span class="p">(</span><span class="n">data_combined</span><span class="p">),</span><span class="w"> </span><span class="n">aes</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">color</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ele</span><span class="p">))</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">scale_color_gradient2</span><span class="p">(</span><span class="n">low</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"lightblue"</span><span class="p">,</span><span class="w"> </span><span class="n">mid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"blue"</span><span class="p">,</span><span class="w"> </span><span class="n">high</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"red"</span><span class="p">,</span><span class="w"> </span><span class="n">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Elevation"</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w">
  </span><span class="n">map_theme</span><span class="w">
</span>

This plots shows the elevation of the location points we’ve been.

3D plots

Because the 2D plot doesn’t show the elevation very clearly, I wanted to plot this in 3D.

<span class="n">library</span><span class="p">(</span><span class="n">scatterplot3d</span><span class="p">)</span><span class="w">

</span><span class="c1"># http://gis.stackexchange.com/questions/142156/r-how-to-get-latitudes-and-longitudes-from-a-rasterlayer
</span><span class="n">r.pts</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">rasterToPoints</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">spatial</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">geo.prj</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">proj4string</span><span class="p">(</span><span class="n">r.pts</span><span class="p">)</span><span class="w">
</span><span class="n">r.pts</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">spTransform</span><span class="p">(</span><span class="n">r.pts</span><span class="p">,</span><span class="w"> </span><span class="n">CRS</span><span class="p">(</span><span class="n">geo.prj</span><span class="p">))</span><span class="w"> 
</span><span class="n">bg_matrix</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">data.frame</span><span class="p">(</span><span class="n">lon</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">coordinates</span><span class="p">(</span><span class="n">r.pts</span><span class="p">)[,</span><span class="m">1</span><span class="p">],</span><span class="w">
                         </span><span class="n">lat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">coordinates</span><span class="p">(</span><span class="n">r.pts</span><span class="p">)[,</span><span class="m">2</span><span class="p">])</span><span class="w">

</span><span class="n">ex_bg</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">extract</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">bg_matrix</span><span class="p">,</span><span class="w"> </span><span class="n">cellnumbers</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">,</span><span class="w"> </span><span class="n">df</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">bg_matrix</span><span class="o">$</span><span class="n">ele</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">ex_bg</span><span class="o">$</span><span class="n">srtm_33_07</span><span class="w">

</span><span class="n">ex_points</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">extract</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w"> </span><span class="n">cbind</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">),</span><span class="w"> </span><span class="n">cellnumbers</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">,</span><span class="w"> </span><span class="n">df</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">

</span><span class="n">s</span><span class="m">3</span><span class="n">d</span><span class="w"> </span><span class="o"><-</span><span class="w"> </span><span class="n">scatterplot3d</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bg_matrix</span><span class="p">[,</span><span class="w"> </span><span class="m">1</span><span class="p">],</span><span class="w"> 
                     </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bg_matrix</span><span class="p">[,</span><span class="w"> </span><span class="m">2</span><span class="p">],</span><span class="w"> 
                     </span><span class="n">z</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">bg_matrix</span><span class="p">[,</span><span class="w"> </span><span class="m">3</span><span class="p">],</span><span class="w"> 
                     </span><span class="n">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"p"</span><span class="p">,</span><span class="w"> 
                     </span><span class="n">pch</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">16</span><span class="p">,</span><span class="w"> 
                     </span><span class="n">highlight.3d</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">,</span><span class="w"> 
                     </span><span class="n">cex.symbols</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.5</span><span class="p">,</span><span class="w"> 
                     </span><span class="n">box</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">FALSE</span><span class="p">,</span><span class="w">
                     </span><span class="n">grid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">FALSE</span><span class="p">,</span><span class="w">
                     </span><span class="n">xlab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Longitude"</span><span class="p">,</span><span class="w">
                     </span><span class="n">ylab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Latitude"</span><span class="p">,</span><span class="w">
                     </span><span class="n">zlab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"Elevation"</span><span class="p">)</span><span class="w">
</span><span class="n">s</span><span class="m">3</span><span class="n">d</span><span class="o">$</span><span class="n">points3d</span><span class="p">(</span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">z</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">ex_points</span><span class="o">$</span><span class="n">srtm_33_07</span><span class="p">,</span><span class="w"> </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"blue"</span><span class="p">,</span><span class="w"> </span><span class="n">pch</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">16</span><span class="p">,</span><span class="w"> </span><span class="n">cex</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.1</span><span class="p">)</span><span class="w">
</span>

The first 3D plot shows a scatterplot of our location points on the elevation profile of Gran Canaria. It was created with scatterplot3d.

But I also wanted to be able to see the 3D plot from different angles, soI used rgl to make interactive 3D plots.

<span class="n">library</span><span class="p">(</span><span class="n">rgdal</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">rasterVis</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">rgl</span><span class="p">)</span><span class="w">
</span><span class="n">library</span><span class="p">(</span><span class="n">htmlwidgets</span><span class="p">)</span><span class="w">
</span>
<span class="n">options</span><span class="p">(</span><span class="n">rgl.printRglwidget</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">

</span><span class="n">open3d</span><span class="p">()</span><span class="w">
</span><span class="n">plot3D</span><span class="p">(</span><span class="n">srtm_c</span><span class="p">,</span><span class="w">  </span><span class="n">maxpixels</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">7e4</span><span class="p">)</span><span class="w">
</span>

Click to open the interactive 3D image and use the mouse to zoom and turn the plot:

3dplot1

This interactive 3D plot shows the elevation profile of the whole island and you can clearly see the various ravines that have been shaped over the years.

Now, I would have liked to plot our location points directly onto this plot, but I couldn’t figure out how to do this (if someone knows, please let me know). Instead, I plotted only our location points in 3D.

<span class="n">options</span><span class="p">(</span><span class="n">rgl.printRglwidget</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">)</span><span class="w">
</span><span class="n">open3d</span><span class="p">()</span><span class="w">
</span><span class="n">plot3d</span><span class="p">(</span><span class="n">data_combined</span><span class="o">$</span><span class="n">lon</span><span class="p">,</span><span class="w"> </span><span class="n">data_combined</span><span class="o">$</span><span class="n">lat</span><span class="p">,</span><span class="w"> </span><span class="n">ex_points</span><span class="o">$</span><span class="n">srtm_33_07</span><span class="p">,</span><span class="w"> 
       </span><span class="n">xlab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">ylab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w"> </span><span class="n">zlab</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
       </span><span class="n">col</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s2">"blue"</span><span class="p">,</span><span class="w"> </span><span class="n">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">5</span><span class="p">,</span><span class="w"> </span><span class="n">alpha</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">0.1</span><span class="p">,</span><span class="w">
       </span><span class="n">lit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">TRUE</span><span class="p">,</span><span class="w">
       </span><span class="n">box</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc"...

To leave a comment for the author, please follow the link and comment on their blog: Shirin's playgRound.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)