Skip to content

Bug in ggplot2 3.4.0 using scales::probability_trans #5112

@andrewgustar

Description

@andrewgustar

Prompted by this question on StackOverflow, https://stackoverflow.com/questions/74809918/y-axis-scaling-to-normal-distribution there seems to be a bug in how ggplot2 3.4.0 does axis transformations. The example that works as expected in version 3.3.5, producing a nice straight line, is

data.frame(v = rnorm(1000)) %>% 
    ggplot(aes(x = v)) + 
    stat_ecdf() + 
    scale_y_continuous(trans=scales::probability_trans("norm"))

Compare that to the same code in 3.4.0, which gives an S-shaped curve and also has the y axis starting at 0.5.

In this case, the transformation seems to be using pnorm and qnorm the wrong way round in adjusting the scale and the axis.

I tried a few other transformations, and several of them look odd, so I think this is an example of something deeper in the axis transformation routine.

I'm using R 4.2.2 on Windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions