r - Understanding the "ymax not defined: adjusting position using y instead" error in ggplot2 -


ggplot(diamonds, aes(carat)) + stat_bin(binwidth=0.1, geom="bar") # no error ggplot(diamonds, aes(carat)) + stat_bin(binwidth=0.1, geom="point") # "ymax not defined" 

the error produced ggplot2's position-collide.r (link):

  if (!is.null(data$ymax)) {     ddply(data, "xmin", strategy, width = width)   } else if (!is.null(data$y)) {     message("ymax not defined: adjusting position using y instead") 

from source code above, seems message appears because ggplot2 checks , there no ymax in data. however, doesn't make sense why ymax exists in first plot not in second. both plots use stat_bin, which produces data frame ymax, ymin, , other things.

so why message appear in second plot?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -