Skip to content

stat_summary_bin strange behavior when combined with scale_y_* #2880

@mkoohafkan

Description

@mkoohafkan

Attempting to do a binned summation of data via fun.y with stat_summary_bin and represent as a line. I get strange y-axis labels when combining with a scale_y_* aesthetic. It looks like a bug to me, but perhaps I misunderstand how to use stat_summary_bin.

library(ggplot2)
ggplot(mtcars) +
  aes(x = disp, y = mpg) +
  stat_summary_bin(fun.y = sum, binwidth = 2.5,
    geom = "line", size = 1)

ggplot(mtcars) +
  aes(x = disp, y = mpg) +
  stat_summary_bin(fun.y = sum, binwidth = 2.5,
    geom = "line", size = 1) +
  scale_y_log10()

ggplot(mtcars) +
  aes(x = disp, y = mpg) +
  stat_summary_bin(fun.y = sum, binwidth = 2.5,
    geom = "line", size = 1) +
  scale_y_sqrt()

Created on 2018-09-04 by the reprex package (v0.2.0).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions