title: Shiny plot in ggplot not respecting "fill" argument in plot command
body: <p>I've included a lot of sample code because I'm new to Shiny (and still very beginner with R) so I'm not sure where the problem lies.</p>
  
  <p>The first two code blocks are the ui.R and server.R of an app, along with a picture of the output.
  The problem I'm having is that the "fill" argument in the ggplot command isn't being respected, and I'm getting a mono-color output in the chart, when it should have two different colors in the histogram dependent upon the "id" value in the DF.</p>
  
  <p>The last block of code and image show essentially the same code being run in R-Studio, with the desired effect achieved. You can see in the included output screenshot that there are two overlain histograms colored by the value of the "id" column. </p>
  
  <p>Thanks for any help! </p>
  
  <h1>Example App:</h1>
  
  <p><em>server.R</em> </p>
  
  <pre><code>library(shiny)
  library(ggplot2)
  
  id &lt;- sample(0:1, 100, replace=T)
  val &lt;- sample(seq(1:25), 100, replace=T)
  val2 &lt;- sample(seq(1:10), 100, replace=T)
  
  data &lt;- data.frame(id, val, val2)
  
  # Define a server for the Shiny app
  shinyServer(function(input, output) {
  
    # Fill in the spot we created for a plot
    output$featurePlot &lt;- renderPlot({
  
      # Render histogram
  
      # Note to readers, the outcome is the same whether the fill command
      # is as written, or written as: fill=as.factor(id)
  
      p &lt;- ggplot(data, aes_string(x=input$feature, fill=as.factor(data$id))) +
          geom_histogram(alpha=0.5, aes(y=..density..), position='identity', binwidth = input$binSize);
      print(p)
    })
  })
  </code></pre>
  
  <p><em>ui.R</em></p>
  
  <pre><code>library(shiny)
  library(ggplot2)
  
  id &lt;- sample(0:1, 100, replace=T);
  val &lt;- sample(seq(1:25), 100, replace=T);
  val2 &lt;- sample(seq(1:10), 100, replace=T);
  
  data &lt;- data.frame(id, val, val2);
  
  # Define the overall UI
  shinyUI(
  
    fluidPage(
  
      titlePanel("why u no color?"),
  
      sidebarLayout(
  
        sidebarPanel(
          selectInput("feature", "Feature:",
                      choices=colnames(data),
                      selected='val'),
          hr(),
          helpText("Select a feature to compare"),
  
          sliderInput("binSize",
                      "Size of Bins",
                      min = 1,
                      max = 10,
                      value = 2)
      ),
  
      mainPanel(
        plotOutput("featurePlot")
      )
    )
  )
  )
  </code></pre>
  
  <p><em>app output</em>:
  <img src="https://i.stack.imgur.com/Id46W.png" alt="output from the app"></p>
  
  <h1>Here is what I want</h1>
  
  <pre><code># Example Data For help
  
  library(ggplot2)
  
  id &lt;- sample(0:1,100,replace=T)
  val &lt;- sample(seq(1:25),100,replace=T)
  val2 &lt;-sample(seq(1:10), 100, replace=T)
  
  df &lt;- data.frame(id, val, val2)
  
  ggplot(df, aes(x=val, fill=as.factor(id))) +
    geom_histogram(alpha=0.7, aes(y=..density..), position = 'identity', binwidth=1)
  </code></pre>
  
  <h1>You can run the code and see the desired output, but here's a picture just in case</h1>
  
  <p><img src="https://i.stack.imgur.com/R3ceL.png" alt="this is what it should look like!"></p>