When using the aesthetic mapping shape
within geom_point
, I get the following message when the number of factors present exceeds 6:
"The shape palette can deal with a maximum of 6 discrete values because more than 6 becomes difficult to discriminate; you have 15. Consider specifying shapes manually. if you must have them."
I tend to agree with the principle of limiting the number of distinct shapes, however when using shape in combination with color this should not be a problem.
Is there an elegant way to get ggplot to cycle through shapes, i.e. setting symbol7 = symbol1 etc? Right now it simply omits the points with factor level > 6.
as you can see you have many possibilities for shapes. When you reach >6 you have to set the number manually, in this way:
ggplot(data=dat1, aes(x=x, y=y,group=method,shape=method,color=method))+
geom_point() +
scale_shape_manual(values=seq(0,15))
In this way you will have no warnings and you will get the corresponding symbols on the graph
Update
As Luchonacho pointed out there are many new shapes available. Remember that if you want to set them using a loop do not use aes()
as it would temporally keep in memory the last plotting reference (i.e. only the last looped input) and plot only that one.