Skip to content

scale_*_continuous trans and limits combination leading to blank plot #2715

@igordot

Description

@igordot

I noticed an odd behavior for scale_*_continuous limits parameter. I think it would be easiest to show an example rather than try to explain.

Set up the plot.

library("ggplot2")
df <- data.frame(trt = c("a", "b", "c"), outcome = c(2.3, 1.9, 3.2))
p <- ggplot(df, aes(trt, outcome)) + geom_col()

Start adjusting scale_y_continuous().

p + scale_y_continuous(trans = "log", limits = c(1, 5))

image

p + scale_y_continuous(trans = "log1p", limits = c(1, 5))

image

p + scale_y_continuous(trans = "log1p", limits = c(0, 5))

image

The first and third plots are expected, but why is the middle empty? There is no error or warning.

I am using R 3.4.4 with ggplot2 2.2.1.

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