-
Notifications
You must be signed in to change notification settings - Fork 2k
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
coord_polar(): moving y axis to the right does not move the tickmarks and tick values #2005
Comments
Thanks for providing some code that illustrates the problem — it's a great start 😄 However, your code is currently a bit too complicated: there's quite a bit of extraneous stuff in there that doesn't seem directly related to the problem. Can you please try and simplify your example some more? The more minimal you can make the reprex, the faster I can identify the problem and fix it. (Please don't include session info unless it's explicitly asked for, or you've used |
# Really simple dataset
heights <- c(100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220,
230, 240, 250)
weights <- c(50.1, 55.1, 60.1, 65.1, 70.1, 75.1, 80.1, 85.1, 90.1, 95.1, 100.1,
105.1, 110.1, 115.1, 120.1, 125.1)
# put it in a data frame
df <- data.frame(heights = heights, weights = weights)
# Prepare a basic line plot
line_plot <- ggplot2::ggplot(df, ggplot2::aes(x = heights, y = weights, group = 1)) +
ggplot2::geom_line(color = "purple")
# Problem: when plotting in polar coordinates positioning the y-axis label and tickmarks to the right only
# moves the label, not the tickmarks
print(line_plot + ggplot2::coord_polar() + ggplot2::scale_y_continuous(position = "right")) |
Thanks! I've made it a bit simpler still: 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_polar()
# OK
plot
# NOT OK: Label moves, but ticks/labels don't
plot + scale_y_continuous(position = "right") |
@thomasp85 can you take a quick look at this one please? |
Yes |
Using the
scale_y_continuous(position="right")
I expected that the y axis (label + tickmarks and values) will move to the right. While this works with "normal" charts it does not seem to do the right thing with coord_polar().Some example code. Point D is where I experience this issue
The text was updated successfully, but these errors were encountered: