I’m having issues with going from ggplot to ggplotly for a USA states map. Specifically, the point fills are getting ignored.
fig results in a plot that have different point fill colors depended on the max rain, but fig 2 turns every point fill to blue.
Any suggestions? Code below:
yesterday <- Sys.Date()-1
fig <- plot_usmap(data = subset(statesdata, Date == yesterday), values = "avgRain", color = "white") +
scale_fill_continuous(low = "yellow", high = "blue", name = "Avg. Rain", limits = c(0, 4)) +
ggtitle(label = paste0("Average Rain (", yesterday, ")")) +
theme(legend.position = "right", plot.title = element_text(hjust = 0.5, size = 18)) +
geom_point(data = data2, aes(x=lon.1, y=lat.1, text=hover, fill=maxRain), color="black", pch=21, size = 2) +
scale_color_continuous(low = "yellow", high = "blue", name = "Max. Rain", limits = c(0, 4))
fig2 <- ggplotly(fig, tooltip = c("hover"))