Skip to content

Instantly share code, notes, and snippets.

@geotheory
Created September 5, 2014 16:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geotheory/24f28d27d4d22350e91d to your computer and use it in GitHub Desktop.
Save geotheory/24f28d27d4d22350e91d to your computer and use it in GitHub Desktop.
Basic Shiny app with Leaflet & ggplot
library(shiny)
library(rCharts)
library(ggplot2)
data(uspop2000, package = 'leaflet')
base_df <- head(uspop2000[which(uspop2000$State == "AL"), ])
shinyServer(function(input, output){
output$myChart <- renderMap({
map3 <- Leaflet$new()
# map3$tileLayer(provider = 'Stamen.TonerLite')
map3$setView(c(32, -86), zoom = 6)
map3$marker(c(32, -86), bindPopup = "Hi. I am a popup")
map3
})
})
library(shiny)
library(rCharts)
library(ggplot2)
library(leaflet)
shinyUI(bootstrapPage(
headerPanel("test"),
mainPanel(
tabsetPanel(
tabPanel("map2", tags$style('.leaflet {height: 400px;}'),showOutput('myChart', 'leaflet'))
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment