Skip to content

scales="free_y" in facet_grid has no effect when geom_bar is used #160

Closed
@jiho

Description

@jiho

Initially I wanted to plot precomputed bars and was in this case

d = data.frame(x=c(runif(10), runif(10)*4), a=rep(c("foo", "bar"), 5), b=rep(c("one", "two"), each=10))

ggplot(d) + geom_bar(aes(x=a, y=x), stat="identity") + facet_grid(.~b)
ggplot(d) + geom_bar(aes(x=a, y=x), stat="identity") + facet_grid(.~b, scales="free_y")

I supposed that stat="identity" was the problem, but apparently it is the same with an histogram

d = data.frame(x=c(runif(20), runif(20)*4), a=runif(40), b=rep(c("one", "two"), each=20))

ggplot(d) + geom_bar(aes(x=a), binwidth=0.2) + facet_grid(.~b)
ggplot(d) + geom_bar(aes(x=a), binwidth=0.2) + facet_grid(.~b, scales="free_y")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions