Skip to content

geom_tile no longer understands width and height outside aesthetics #1513

Closed
@mariodejung

Description

@mariodejung

I just copy my problem from stack overflow to here since someone recommended to report this behaviour. (http://stackoverflow.com/questions/34986829)

Since switching to ggplot2 2.0.0 there are problems in defining the width and height of a tile outside the aesthetics.
I used the geom_tile to create some kind of a heatmap and I wanted to have a little space between the tiles, so I used in the older version of ggplot2 the width=.9 and height=.9 parameters, but this fails in the new version.

df <- data.frame(x=letters[1:10], y=rep(LETTERS[1:10], each=10), value=runif(100))
ggplot(df, aes(x, y, fill=value)) + geom_tile()
ggplot(df, aes(x, y, fill=value)) + geom_tile(width=.9, height=.9)

The only way to get this working is by adding columns with width and height into the data frame and use the aesthetics. Is this supposed to work like this? Or do I miss something here?

df <- data.frame(x=letters[1:10], y=rep(LETTERS[1:10], each=10), 
                 value=runif(100), w=.9, h=.9)
ggplot(df, aes(x, y, fill=value)) + geom_tile(aes(width=w, height=h))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions