The following Shiny app combining ggmap and plotly with heatmap:
require(ggplot2)
require(plotly)
require(ggmap)
require(shiny)
server = function(input, output, session, module_input) {
output$map = renderPlotly({
d = data.frame(lon = rnorm(1e5, mean = mean(c(-125, -66)), sd=4),
lat = rnorm(1e5, mean = mean(c(25, 50)), sd=4))
bb = list(bottom = 25, left = -125, top = 50, right = -66)
basemap = get_stamenmap(bbox = unlist(bb), zoom = 4, maptype = 'toner-lite')
p = ggmap(basemap) +
stat_bin2d(data = d, aes(lon, lat), alpha = 0.75, drop = TRUE) +
scale_fill_continuous(low = 'grey95', high = 'red')
ggplotly(p)
})
}
ui = function() {
plotlyOutput('map', width = '100vw', height = '100vh')
}
shinyApp(ui, server, options = list(launch.browser = FALSE))
.. works fine but generates a confusing and unnecessary warning that is clogging up my error logs. Have tried suppressWarnings
around the plotly call, shinyApp()
call, and even the whole script without success (knowing the latter of these two would be bad practice). Any other ideas?
Warning: 'heatmap' objects don't have these attributes: 'mode'
Valid attributes include:
'autocolorscale', 'coloraxis', 'colorbar', 'colorscale', 'connectgaps', 'customdata', 'customdatasrc', 'dx', 'dy', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hoverongaps', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'legendgroup', 'legendgrouptitle', 'legendrank', 'meta', 'metasrc', 'name', 'opacity', 'reversescale', 'showlegend', 'showscale', 'stream', 'text', 'textsrc', 'transforms', 'transpose', 'type', 'uid', 'uirevision', 'visible', 'x', 'x0', 'xaxis', 'xcalendar', 'xgap', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'xtype', 'y', 'y0', 'yaxis', 'ycalendar', 'ygap', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'ytype', 'z', 'zauto', 'zhoverformat', 'zmax', 'zmid', 'zmin', 'zsmooth', 'zsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'
Warning: 'heatmap' objects don't have these attributes: 'mode'
Valid attributes include:
'autocolorscale', 'coloraxis', 'colorbar', 'colorscale', 'connectgaps', 'customdata', 'customdatasrc', 'dx', 'dy', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hoverongaps', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'legendgroup', 'legendgrouptitle', 'legendrank', 'meta', 'metasrc', 'name', 'opacity', 'reversescale', 'showlegend', 'showscale', 'stream', 'text', 'textsrc', 'transforms', 'transpose', 'type', 'uid', 'uirevision', 'visible', 'x', 'x0', 'xaxis', 'xcalendar', 'xgap', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'xtype', 'y', 'y0', 'yaxis', 'ycalendar', 'ygap', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'ytype', 'z', 'zauto', 'zhoverformat', 'zmax', 'zmid', 'zmin', 'zsmooth', 'zsrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'