I am attempting to create a map in which each US state is colored according 
to a character type categorical variable. I am able to get the map to 
render, but all of the tooltips show a numeric value instead of the 
character string in my variable. Here's a reproducible example:

library(googleVis)
library(datasets)


category <- c("A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E",
           "A","B","C","D","E")

hover <- c(1:50)

data <- data.frame(state.name,category,hover)

Map <- gvisGeoMap(data, "state.name", "category", "hover",
                    options=list(region="US", 
                                 displayMode="regions", 
                                 resolution="provinces",
                                 width=600, height=400))
plot(Map)

The map assigns colors correctly for "category," but the tooltip shows 
category as a number, rather than a letter A - E. Ultimately, I would like 
to be able to assign discrete colors to each category, rather than using a 
gradient, but I'll take one step at a time with my questions. The end goal 
is to use this map in a Shiny app. Any help is much appreciated.


P.S. I've tried gvisGeoChart with essentially the same result. Simply 
assigning hover = category doesn't work in my situation; in the final 
product, I will be displaying a separate hover variable in the tool tip.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/7b21882e-f786-41c5-9da4-f1293ea175b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to