This code works but when I change the slider to load year it lags VERY bad. I have read about plotlyproxy but can get the map to just load once. I just want the ggmap to load once and then overlay and change the points.
Any help or info on PlotlyProxy would be much appreciated as i can’t find much info online
output$map <- renderPlotly({
df <- df_groups_year()
max_per <- max(df_groups()$Percentage)
min_per <- min(df_groups()$Percentage)
#myPalette <- colorRampPalette(rev(brewer.pal(8, "Dark2")))
sc <- scale_colour_gradient(low = "white", high = "forestgreen", limits=c(min_per, max_per))
mecklenburg <-
ggmap(darken = c(.08, "black"),
get_googlemap(center = c(lon = -80.845392, lat = 35.241270),
size = c(720, 840),
zoom = 11,
scale = 2,
maptype = 'roadmap',
color = 'color'))
map <- mecklenburg +
geom_point(aes(x = lon, y = lat, group= School,colour = Percentage),
data = df,
size = 2)+
#scale_colour_gradient(low = "blue", high="white",limits=c(0,.9))+
labs(title = "CMS School District",
x='', y ='') +
sc +
theme(title = element_text(size = 10))
ggplotly(map,tooltip = c("School", "Percentage"))
})