Skip to content

Changing position value in scale_ interacts strangely with coord_trans() #4551

Closed
@courtiol

Description

@courtiol

Applying any transformation using coord_trans() modifies what the argument position does in scale_:
(notice that only the title of the axis is sent to the top and no longer the labels when coord_trans() is used)

library(ggplot2)
  
packageVersion("ggplot2")  ## note: current devel does also behave in the same way
#> [1] '3.3.5'

ggplot(data = iris) +
  geom_point(aes(y = Sepal.Length, x = Species)) +
  scale_x_discrete(position = "top")

ggplot(data = iris) +
  geom_point(aes(y = Sepal.Length, x = Species)) +
  scale_x_discrete(position = "top") +
  coord_trans(y = "identity")

Created on 2021-07-08 by the reprex package (v2.0.0)

The same goes for the left/right positions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorguides 📏

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions