Closed dafxy closed 1 month ago
This is what I get with version 3.4.4:
Polygons are properly closed now, i.e. they are connected by a line segment that is correctly munched by the coordinate system. The previous behaviour was incorrect, which can also be shown with your example plot. You can clearly see that the 'B' shape has a self-intersection in Cartesian coordinates.
library(ggplot2)
set.seed(10)
df = data.frame(x = 1:10,
y = runif(10),
g = sample(c('A', 'B'))
)
p <- ggplot(df) +
geom_polygon(aes(x=x, y=y, color=g, fill=g), alpha=.5)
p
And this self-intersection is displayed in polar coordinates.
p + coord_polar()
Created on 2024-05-29 with reprex v2.1.0
Right, but for visualization of statiscal summaries purposes, I want to have something like in v 3.4.4, but that is completely gone, and it is breaking old code. Can you add that back, maybe witth a option in the function?
Could you reopen this, please? This is not how people have used it. The one on v 3.4.4 is how many people have use it for stat visualization. See https://www.nature.com/articles/s41562-024-01908-6, for instance.
I'm afraid the article isn't accessible to me. Could you post a reproducible example of where the current behaviour is either misleading or incorrect, whereas the previous behaviour wasn't?
That is in the initial measage. Whatever you had in version 3.4.4 was working just fine. This is not about mapping straight lines from Cartesian coordinates onto polar coordinates, curving the plot lines altogether with the axis. This is about having the polar coordinate to help with visualization of the points. Jus that.
This was working in older ggplot versions, but now it is not working anymore on version 3.5.1. The racial coordinate should connect the ending and starting points. Using polar coordinates instead of radial also does not work.