Vijay Ivaturi
Vijay Ivaturi

Reputation: 848

Missing plotting symbol for geom_point when using shape

I must be obviously missing something simple, or this is a small bug. The geom_point () is always missing a plotting symbol when the shape=factor is used. This does not happen when color=factor is used. Appreciate your help. Here is a test code.

test <- data.frame(let=sample(LETTERS,7), id=c(1:7), y=c(id*7))

ggplot(data=test, aes(x=id, y=y))+
geom_point(aes(shape=let), size=6)

"Notice here the missing point (only 6 out 7) as one of the symbol is missing, which usually is alphabetically the last factor"

ggplot(data=test, aes(x=id, y=y))+
geom_point(aes(color=let), size=6)

"Here we see 7 points with different colors"

Thanks, VJ

Upvotes: 4

Views: 2551

Answers (1)

baptiste
baptiste

Reputation: 77116

That's because scales::shape_pal defines a maximum of 6 values; try adding scale_shape_manual(values=1:7)

Upvotes: 5

Related Questions