Is there a documentation indicating the different shape names available for geom objects?

I was looking into the different shapes that can be passed into, say, geom_point() and I found this old closed GH issue discussing about the ability of using names of shapes instead of a numeric value from 0 to 25. I know this is implemented and it works (e.g.:

ggplot(mtcars, aes(x = mpg, y = wt)) + 
  geom_point(shape = "triangle filled", fill = "steelblue")`

)

I was just wondering, is there an actual documentation that finalizes the list of the various names that can be fed into the shape argument, instead of its numeric counterpart? I've looked around but haven't had luck something authoritative.

help(scale_shape)

I looked at that page, but I didn't see anything that answers my question.

library(ggplot2)
df_shapes <- data.frame(shape = 0:24)
ggplot(df_shapes, aes(0, 0, shape = shape)) +
  geom_point(aes(shape = shape), size = 5, fill = 'red') +
  scale_shape_identity() +
  facet_wrap(~shape) +
  theme_void()

p <- ggplot(mtcars, aes(x = mpg, y = wt)) 
p + geom_point(shape = 1)

p + geom_point(shape = 2)

# ...
p + geom_point(shape = 12)

Created on 2020-08-14 by the reprex package (v0.3.0)

Also see this

library(ggplot2)
shape_names <- c(
  "circle", paste("circle", c("open", "filled", "cross", "plus", "small")), "bullet",
  "square", paste("square", c("open", "filled", "cross", "plus", "triangle")),
  "diamond", paste("diamond", c("open", "filled", "plus")),
  "triangle", paste("triangle", c("open", "filled", "square")),
  paste("triangle down", c("open", "filled")),
  "plus", "cross", "asterisk"
)

shapes <- data.frame(
  shape_names = shape_names,
  x = c(1:7, 1:6, 1:3, 5, 1:3, 6, 2:3, 1:3),
  y = -rep(1:6, c(7, 6, 4, 4, 2, 3))
)

ggplot(shapes, aes(x, y)) +
  geom_point(aes(shape = shape_names), fill = "red", size = 5) +
  geom_text(aes(label = shape_names), nudge_y = -0.3, size = 3.5) +
  scale_shape_identity() +
  theme_void()

Created on 2020-08-14 by the reprex package (v0.3.0)

1 Like

You can use ?points

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.