Open dafxy opened 2 weeks ago
Repeating from previous discussion: Could you post a reproducible example of where the current behaviour is either misleading or incorrect, whereas the previous behaviour wasn't?
From previous discussion: 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.
What I believe @dafxy is after is a spider/radar plot option, which, true, isn't possible currently
I personally only think such a thing makes sense for a discrete scale so I don't know if this should be a new coordinate system altogether or something (wrongly) tacked on to coord_radial()
Yes!
Thanks Thomas, that makes the intent more clear because that is a somewhat different coordinate system than the polar ones.
@dafxy I think you might be looking for coord_radar()
offered by {see}.
library(ggplot2)
set.seed(10)
df = data.frame(x = 1:10,
y = runif(10),
g = sample(c('A', 'B'))
)
ggplot(df) +
geom_polygon(aes(x=x, y=y, fill=g), alpha=.5) +
see::coord_radar()
Created on 2024-06-20 with reprex v2.1.0
I'm not sure if this is worth carrying over to ggplot2, as it already exists in extension packages.
An argument for bringing it over would be to give it the same treatment as coord_polar() got with coord_radial(), i.e. support for the new axes
One particular nuance is that coord_polar()
(on which see::coord_radar()
is based) sort-of hardcodes decorations (panels, grid, axes), whereas coord_radial()
munches these decorations. Simply setting the is_linear()
method to TRUE
, as see::coord_radar()
does, will mistransform the decorations in coord_radial()
.
yes, we obviously need a better approach if we should do it... For now see
is the way
An additional concern will be how to treat polygons spanning start/end boundaries.
I'm going to consider this a feature request for a spider/radar coord instead of a report on the lack of options.
See https://github.com/tidyverse/ggplot2/issues/5913. It should be reopened.