rstudio / ggvis

Interactive grammar of graphics for R
Other
713 stars 172 forks source link

Object not found for fill when x axis is of class 'Date' #325

Open chrisaxelson opened 9 years ago

chrisaxelson commented 9 years ago

Hi there,

There appears to be an error when trying to use 'fill' when the x axis is of class 'Date' (but not otherwise).

library(ggvis)
library(ggplot2)

data <- data.frame("Date" = c(as.Date("2014-11-17"), as.Date("2014-11-17"), as.Date("2014-11-18")),
                   "Weekday" = c("Monday", "Monday", "Tuesday"),
                   "Hours" = c(5,3,8),
                   "Work" = c("Writing", "Reading", "Analysis"))

ggplot(data = data, aes(x = Date, y = Hours, fill = Work)) + geom_bar(stat = 'identity')

data %>% 
  ggvis(x = ~Weekday, y = ~Hours, fill = ~Work) %>%
  layer_bars()

data %>% 
  ggvis(x = ~Date, y = ~Hours, fill = ~Work) %>%
  layer_bars() 

Not sure if this is an error or expected behaviour? My first ever question so my apologies if this is silly / poor etiquette / should have been in google groups - but I didn't find the answer anywhere else.

P.S. You guys are awesome.

brandonwillard commented 9 years ago

Related to #340 and/or #309?