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

Support more than 6 shapes for geom_point() #6305

Closed
hsiaoyi0504 opened this issue Jan 23, 2025 · 3 comments
Closed

Support more than 6 shapes for geom_point() #6305

hsiaoyi0504 opened this issue Jan 23, 2025 · 3 comments

Comments

@hsiaoyi0504
Copy link

More than 6 shapes will be empty in the current implementation

library(ggplot2)
m <- matrix(rnorm(20) , nrow = 10)
m <- as.data.frame(m)
colnames(m) <- c("x", "y")
m$num <- as.character(1:nrow(m))

ggplot(m, aes(x, y, shape=num)) +
  geom_point()

Image

Similar issue discussed on StackOverflow: https://stackoverflow.com/questions/26223857/more-than-six-shapes-in-ggplot

@joranE
Copy link
Contributor

joranE commented Jan 23, 2025

I believe you also likely received a warning message with that code that strongly suggests that this limitation is not an oversight but a conscious design decision on the part of the ggplot2 authors. The fact that this was a deliberate choice might influence how one goes about making an argument to reverse it.

@clauswilke
Copy link
Member

From the documentation:

If you have more than six levels, you will get a warning message, and the seventh and subsequent levels will not appear on the plot. Use scale_shape_manual() to supply your own values.

I suspect the reason this is how it's implemented is that using that many different shapes will typically create terrible plots that we want to discourage that. So if you really need (want) more than six shapes you have to specify them manually.

@teunbrand
Copy link
Collaborator

I agree with Joran and Claus. I think the current behaviour is aligned with the philosophy that we'd like it to be easy to do the good thing and harder, but not impossible, to do less good things. That said, ggplot2 fully supports >6 shapes as long as you give an appropriate palette. It is the default shape palette defined in the {scales} package that doesn't support it. For these reasons, I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants