Skip to content
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

Feature request: radar/spider coordinate system #5950

Open
dafxy opened this issue Jun 20, 2024 · 10 comments
Open

Feature request: radar/spider coordinate system #5950

dafxy opened this issue Jun 20, 2024 · 10 comments
Labels
coord 🗺️ feature a feature request or enhancement

Comments

@dafxy
Copy link

dafxy commented Jun 20, 2024

See #5913. It should be reopened.

@teunbrand
Copy link
Collaborator

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?

@dafxy
Copy link
Author

dafxy commented Jun 20, 2024

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.

@thomasp85
Copy link
Member

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()

@dafxy
Copy link
Author

dafxy commented Jun 20, 2024

Yes!

@teunbrand
Copy link
Collaborator

teunbrand commented Jun 20, 2024

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.

@thomasp85
Copy link
Member

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

@teunbrand
Copy link
Collaborator

teunbrand commented Jun 20, 2024

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().

@thomasp85
Copy link
Member

yes, we obviously need a better approach if we should do it... For now see is the way

@teunbrand
Copy link
Collaborator

An additional concern will be how to treat polygons spanning start/end boundaries.

image

@teunbrand teunbrand added coord 🗺️ feature a feature request or enhancement labels Jun 27, 2024
@teunbrand
Copy link
Collaborator

I'm going to consider this a feature request for a spider/radar coord instead of a report on the lack of options.

@teunbrand teunbrand changed the title Polar plot lacks straight line option with geom_polygon in new ggplot version Feature request: radar/spider coordinate system Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coord 🗺️ feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants