Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
courtiol opened this issue Jul 8, 2021 · 4 comments · Fixed by #3972
Closed

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

courtiol opened this issue Jul 8, 2021 · 4 comments · Fixed by #3972
Labels
bug an unexpected problem or unintended behavior guides 📏

Comments

@courtiol
Copy link

courtiol commented Jul 8, 2021

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.

@teunbrand
Copy link
Collaborator

This might be related to #3959, but because "Species" is on top it would suggests that facets are aware of the position but coords might not be.

@thomasp85
Copy link
Member

Potentially also related to #4650

@thomasp85 thomasp85 added bug an unexpected problem or unintended behavior guides 📏 labels Oct 28, 2021
@thomasp85
Copy link
Member

@paleolimbot all of these issues seems to be related to the fact that only coord_cartesian()was moved over to the new axis guide generation pipeline... are you up for moving the remaining coords?

@yutannihilation
Copy link
Member

This will be fixed by #3972.

devtools::load_all("~/GitHub/ggplot2/")
#> ℹ Loading ggplot2

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

Created on 2022-07-08 by the reprex package (v2.0.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior guides 📏
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants