title: R changing labels in an animated map using ggplotly and geom_sf
body: <p>I want to create an animated map that shows the number of incidents over time in Pittsburgh, PA (by neighborhood). I can create the map, but I can't figure out how to add the name of the Neighborhood in the tooltip. This is my code so far.</p>
  
  <pre><code>library(plotly)
  library(ggplot2)
  library(sf)
  
  
  #Downloading shapefile
  download.file("http://pghgis-pittsburghpa.opendata.arcgis.com/datasets/dbd133a206cc4a3aa915cb28baa60fd4_0.zip",
                destfile = "Pittsburgh_Neighborhoods",mode = 'wb')
  unzip("Pittsburgh_Neighborhoods", exdir = ".")
  
  Neighborhoods &lt;-  st_read("Neighborhoods_.shp") %&gt;% 
    st_transform(crs = "+proj=longlat +datum=WGS84")
  
  #Creating fake data
  dates &lt;- seq(as.Date('2017-01-01'),as.Date('2019-12-31'),by = "1 month")
  count &lt;- sample(1:30,3240,replace=T)
  neigh &lt;- Neighborhoods$hood
  
  df &lt;- merge(dates,neigh)
  colnames(df) &lt;- c("Month_Yr", "Neighborhood")
  df$count &lt;- count
  df$Month_Yr &lt;- format(df$Month_Yr, "%Y-%m") ##Changing to charch
  
  #Merging data frame with neighborhoods layers
  map_data &lt;- merge(Neighborhoods, df, by.x = "hood", by.y = "Neighborhood")
  
  #######Create plot with text
  p_map2 &lt;- ggplot() +
    geom_sf(data = Neighborhoods, colour = "#ffffff20", fill = "#2d2d2d60", size = .5) +
    geom_sf(data = map_data, aes(fill = count, frame = Month_Yr,
                                 text = paste0(
                                   "Neighborhood: ", hood, "\n",
                                   "Month Year: ", Month_Yr, "\n",
                                   "Number of fake incidents: ", count
                                 ))) +
  
    ggtitle("Fake incidents over time in Pittsburgh") +
    scale_fill_viridis_c(option = "magma",begin = 0.1, direction = -1) +
    theme_void() + 
    theme(axis.title.x=element_blank(), axis.text.x=element_blank(),
          axis.ticks.x=element_blank(),
          axis.title.y=element_blank(), axis.text.y=element_blank(),
          axis.ticks.y=element_blank())
  
  #animating the map using ggplotly
  pg_map2 &lt;- p_map2 %&gt;%
    ggplotly(tooltip = "text") %&gt;% ##adding the text in the tooltip
    style(hoverlabel = list(bgcolor = "white"), hoveron = "fill") %&gt;%
    plotly_build()
  
  #for some weird reason, the map animates the polygons and not the data, correcting that... 
  pg_map2$x$frames &lt;- lapply(
    pg_map2$x$frames, function(f) { 
      f$data &lt;- lapply(f$data, function(d) d[!names(d) %in% c("x", "y")])
      f 
    })
  
  #Adding animation bar
  pg_map2 %&gt;% 
    animation_button(
      x = 1, xanchor = "right", y = 0, yanchor = "bottom"
    ) %&gt;%
    animation_slider(
      currentvalue = list(prefix = "Month Year ", font = list(color="red"))
    )
  
  </code></pre>
  
  <p>But when I hover over the map in any neighborhood and click play or drag the slider, all the legend changes. For instance,  this neighborhood should be "Central business district." Is there a way to keep the name of the neighborhood the same and only change the counts and date (if you are hovering a specific area)? </p>
  
  <p><a href="https://i.stack.imgur.com/F3f8N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F3f8N.png" alt="Date 2017_3"></a></p>
  
  <p><a href="https://i.stack.imgur.com/R74uX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R74uX.png" alt="Date 2017_5"></a></p>
  
  <p>Thanks so much in advance</p>