I just uploaded a new function to Github. The main aim is to allow a quick look at large Lon/Lat datasets. The function can be directly downloaded from My Github site
Or through the direct link here
In order to use the function, just download it, save the file somewhere and load it into your R script with:
INTERACTIVE PLOT OF LON – LAT AND A VARIABLE DATA
Created by Sven Gastauer 2016
Dependencies: shiny, ggplot2, ggmap, Cairo, colorRamps, RColorBrewer,DT
- dataset = name of the dataset to be used e.g. speed_data
- Lon = [character] name of the Longitude variable, default = “Longitude”, class= character, e.g. “Lon”
- Lat = [character] name of the Latitude variable, default = “Latitude”, class = character, e.g.”Lat”
- variable = [character] name of the variable to define the color scale on the maps (must be a numeric variable), class= numeric, e.g. “Speed”
- mapoffset = [numeric] degrees which will be added to the min/max longitude/latitude to make the map more readable, default=1, class=numeric
- mapsource = [character] source of the background map as defined by ggmap, default = “stamen”, options are: Google Maps (“google”), OpenStreetMap (“osm”), Stamen Maps (“stamen”), or CloudMade maps (“cloudmade”)
- maptype = [character] type of the map as defined by ggmap, default = “toner”, options are: “terrain”, “terrain-background”, “satellite”, “roadmap”, and “hybrid” (google maps), “terrain”, “watercolor”, and “toner” (stamen maps), or a positive integer for cloudmade maps (see ?get_cloudmademap)
- colour = [character] colour of the background map as defined by ggmap, default = “bw”, can be either colour (“color”) or black-and-white (“bw”)
Draw a box on th efirst plot, will create the dataset for the second plot.
Drawing a box on the second plot will create the dataset for the datable and the third plot. Double clicking on the second plot will zoom into the box, another double click will zoom out again.
The datable can be sorted by any element and filtered by the search box.
The third plot has the ability to change colors, and size of the elements as well as axes, depending on selections mad by the combo boxes. Double clickeng inside a drawn box will zoom in. Single click on a point will display its value below the graph.
source('intplot.R') intplot(mydata, "Lons","Lats","coolvariable", 0.5, "google", "terrain","color")
intplot(mydata,variable="variable") #assuming mydata contains columns Longitude, Latitude, variable
Please notify the author if results of this function are used in any sort of publication
For contact, suggestions or support contact the author