shinyでggplot2を使う

ここを参考に
http://www.stanford.edu/~cengel/cgi-bin/anthrospace/building-my-first-shiny-application-with-ggplot

ui.R

library(shiny)

shinyUI(
  pageWithSidebar(
    headerPanel("iris shiny"),
    sidebarPanel(),
    mainPanel(plotOutput("irisPlot"))
  )
)

server.R

library(shiny)
library(ggplot2)

shinyServer(function(input,output){
  output$irisPlot <- renderPlot({
    p <- ggplot(iris,aes(x=Sepal.Length,y=Sepal.Width,color=Species))+geom_point()+theme_bw() 
    print(p)
  })  
})