0

Please I am trying to plot different zipcodes in R on the map for houston, TX .I already plotted the zipcodes which appear as colored circles on the map .How do I plot the actual zipcodes on the map so that when you hover the mouse on the map the zipcodes appear or displays.?

library(ggplot2)
library(maps)
library(ggmap)

x1 <- as.character(data$zips)
lonlat_sample <- sapply(x1 , function(x1){as.numeric(geocode(x1))})

lonlat1 <- t(lonlat_sample)
complete1 <- data.frame(data,lonlat1)

colnames(complete1) <- c("zips", "ER","long","lat")

map <- get_map(location = "harris county", zoom=9) 
mapPoints <- ggmap(map, fullpage=TRUE) +
  geom_point(aes(x = long, y = lat, size = ER, col="class"), data = complete1, alpha = .8)
mapPoints
chh
  • 1
  • 1
  • 1
    Can you share the code that got you to the current question? – lawyeR Apr 15 '15 at 16:01
  • @chh, please edit your question and add the code to it. – Richard Erickson Apr 15 '15 at 17:14
  • @chh, Thanks for editing your code. One more thing, if possible, would you please post example data. The post on [reproducible examples](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) talks about how to do this. – Richard Erickson Apr 15 '15 at 18:29
  • 3
    If you want interactivity, "o that when you hover the mouse on the map the zipcodes appear or displays", you'll need something like `ggvis`, or a Shiny app. `ggplot` produces static graphs. – Gregor Thomas Apr 15 '15 at 18:39
  • @Gregor , Okay trying that to see how i will be able to use that – chh Apr 15 '15 at 18:41
  • @Gregor , so in the case of the ggvis what will the be the environment ( ie env = parent.frame()) ,will this be? `ggvis(data=null, ......, env = parent.frame())` – chh Apr 15 '15 at 19:22
  • @chh, I don't know how to solve your problem. However, I though I could help you write a question that other people would be able easily answer. – Richard Erickson Apr 15 '15 at 19:47

0 Answers0