2

I am trying to plot lat/long using PlotOnStaticMap function from the RgoogleMaps library in R.

library(RgoogleMaps);library(plotrix);
mydata <- read.csv(file=name,header=T,sep=",")
map1 <- PlotOnStaticMap(lat = mydata1$latitude, lon = mydata1$longitude, zoom=1, cex=1, pch=1, col="green", FUN=points, add=F, size = c(640,640))

and then I am trying to create a facet using other field that has two values "Yes/No"

map1 + facet_grid(section_status ~.)

I understand the function "facet_grid" is from plotrix library. However, is there any way to combine the two, or create a facet of Maps?

Vishal R
  • 1,279
  • 1
  • 21
  • 27
  • `facet_grid` sounds like a `ggplot2` thing. I don't think this will work unless you go with a `ggplot2` paradigm. It can also plot maps from shape files, unless you want a specific background. – Roman Luštrik Mar 02 '16 at 12:09
  • Thanks Roman Lustrik, I was able to create map facets using the following code: my_graph<- ggplot(my_file, aes(x=yield_value))+geom_histogram(binwidth = 2,colour="white"); my_graph + facet_grid(section_status ~.); – Vishal R Mar 03 '16 at 08:48
  • There's no need for ending `;`. Feel free to answer your own question with the code that worked for you. – Roman Luštrik Mar 03 '16 at 09:00
  • ggplot() + geom_point(data=mapdata, aes(x=longitude, y=latitude), color="green") + facet_grid(section_status ~.) – Vishal R Mar 03 '16 at 09:06

0 Answers0