library(tigris)
library(sf)
library(ggplot2)
library(plotly)
library(stringr)

options(tigris_use_cache = TRUE)

ct <- read_sf("../Shapefiles/CT_censustracts.shp")
town <- read.csv("../Shapefiles/tract2town-2010.csv")
town$fips <- str_pad(town$tract_fips, width=11, pad="0")


ct <- merge(ct, town, by.x="GEOID", by.y="fips")
# Project the shapefile
ct.p <- st_transform(ct, 26918)

# Remove Water census tracts
ct.p <- ct.p[ct.p$ALAND !=0,]

# plot_ly(ct.p,
#         color=I("white"),
#         stroke=I("darkblue"),
#         text=~paste("GEOID =", GEOID, "\nTown =", town, "\nCounty =", county),
#         hoverinfo="text")

# p <- ggplot(ct.p, aes(tooltip=GEOID)) + 
#   geom_sf(fill="white", color="darkblue", linewidth=0.2) +
#   theme_bw()


p <- ggplot(ct.p, aes(geometry=geometry, label=GEOID, text=paste("Town =", town, "\nCounty =", county))) + 
  geom_sf(fill="white", color="darkblue", linewidth=0.2) +
  theme_bw()

ggplotly(p,
         tooltip=list("label", "text")) 

After Zooming in, double click map to return to default zoom.