Skip to content

Reciprocal transformation to continuous scale drops axis #5271

Closed

Description

@sdmason

R version 4.2.3
{ggplot2} version 3.4.2

In replicating some of the examples from section 10.1.7 in "ggplot2: Elegant Graphics for Data Analysis" I found that the following code produces a figure without a guide on the y axis (see image below) despite the same code rendering a y axis in the book.

library(ggplot2)
ggplot(mpg, aes(displ, hwy)) + 
  geom_point() + 
  scale_y_continuous(trans = "reciprocal")

image

Other transformations passed to scale_y_continuous() (e.g., "log10", "sqrt") work as expected. The book uses an older version of {ggplot2} (3.3.6), so I'm wondering if this behavior might be a bug in the latest version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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