I want to partly disable hover text in plotly, limiting it to one dataframe or geom in ggplot. In the case below, I want hover only on the "cities" not the map outline. I've seen a solution in Python, but not R. And how would I control the image size to keep the map dimension right in plotly? The map demo at https://plot.ly/ggplot2/interactive-tooltip/ seems not to care!
library(mapdata)
library(ggplot2)
library(plotly)
Japan <- map_data("world2Hires", region="Japan")
Longitude <- 140
Latitude <- 36.5
df <- cbind.data.frame(Longitude,Latitude)
df$Name <- "Tokyo"
df$Name_2 <- "Tōkyō"
XX <- ggplot() + geom_polygon(data=Japan, aes(x=long, y=lat, group=group), color="black", fill="white", text="") + coord_equal() + geom_point(data=df, aes(x=Longitude, y=Latitude, text=Name), color="green")
XX
ggplotly(XX) ##How to get hover text only on df not Japan, and remove "[object Object]"
XX <- ggplot() + geom_polygon(data=Japan, aes(x=long, y=lat, group=group), color="black", fill="white", text="") + coord_equal() + geom_point(data=df, aes(x=Longitude, y=Latitude, text=Name_2), color="green")
XX
ggplotly(XX) ##Non-Ascii text breaks hover