Skip to content

coord_map(): moving y axis to the right does not move all axis elements #3042

Closed
@W-L

Description

@W-L

Hi,
this is almost identical to issue #2005 (fixed by #2062) but for coord_map(), instead of coord_polar(). When the y-axis is moved to the right by scale_y_continuous(position = "right"), only the axis label is moved. I adapted the reprex from that previous issue:

library(ggplot2)

df <- data.frame(
  heights = c(100, 110, 120, 130, 140, 150), 
  weights = c(50.1, 55.1, 60.1, 65.1, 70.1, 75.1)
)

plot <- ggplot(df, ggplot2::aes(x = heights, y = weights, group = 1)) + 
  geom_line(color = "purple") + 
  coord_map()

# OK
plot 

# NOT OK: Label moves, but rest does not
plot + scale_y_continuous(position = "right")

okplot
notokplot

Cheers!

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