title: GGplot scale_fill_discrete not creating a legend
body: <p>I used the code in a prior stackoverflow post, which previously made me the graph i wanted, with a legend, however now i am using the exact same code yet i am not getting a legend on my barplot.</p>
  
  <pre><code>dput(year.dat2)
  structure(list(year = structure(c(1136044800, 1167577200, 1199113200, 
  1230735600, 1262275200, 1136044800, 1167577200, 1199113200, 1230735600, 
  1262275200, 1136044800, 1167577200, 1199113200, 1230735600, 1262275200
  ), class = c("POSIXct", "POSIXt"), tzone = ""), variable = structure(c(1L, 
  1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L), .Label = c("SM1", 
  "SM2", "SM3"), class = "factor"), value = c(1.24863586758821, 
  1.23185757914453, 1.10997352162401, 1.13683917747257, 0.987520605867152, 
  2.21498726809749, 1.6378992693761, 1.25635623380691, 1.13585705516765, 
  1.10169569342842, 7.40955802109858, 5.7940698875978, 6.03438772314438, 
  6.82271157830123, 7.24402375195127)), row.names = c(NA, -15L), .Names = 
  c("year", 
  "variable", "value"), class = "data.frame")
  
  ggplot(year.dat2, aes(x = year, y = value, fill = factor(variable))) +
    geom_bar(stat = "identity", position = "dodge")+
    scale_fill_discrete(name = "variable",
                        breaks = c(1, 2, 3),
                        labels = c("SM1", "SM2", "SM3")) +
    xlab("year") + 
    ylab("yearly Sub Mean")
  </code></pre>
  
  <p>Resulting plot:</p>
  
  <p><a href="https://i.stack.imgur.com/9GPus.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9GPus.png" alt="plot"></a></p>