This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(Vy, aes(F2, F1, color = Vowel))+ | |
geom_point()+ | |
theme_bw()+ | |
scale_x_continuous(trans = revlog_trans())+ | |
scale_y_reverse()+ | |
stat_ellipse(level = 0.95)+ | |
opts(legend.position = "none")+ | |
annotate(geom="text", x=2900, y = 460, label = "iyC", size = 5)+ | |
annotate(geom="text", x=2400, y = 750, label = "eyC", size = 5)+ | |
annotate(geom="text", x=1850, y = 970, label = "ay", size = 5) |
For a black and white image, however, it's trickier. I don't usually find grey color scales to be sufficiently different for a plot like this, so I'd go for different point shapes. Unfortunately, the default shape scale in ggplot2 isn't very distinct in this case.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(Vy, aes(F2, F1, shape = Vowel))+ | |
geom_point()+ | |
theme_bw()+ | |
scale_x_continuous(name = "F2", trans = revlog_trans())+ | |
scale_y_reverse(name = "F1")+ | |
stat_ellipse(level = 0.95)+ | |
opts(legend.position = "none")+ | |
annotate(geom="text", x=2900, y = 460, label = "iyC", size = 5)+ | |
annotate(geom="text", x=2400, y = 750, label = "eyC", size = 5)+ | |
annotate(geom="text", x=1850, y = 970, label = "ay", size = 5) |
My first strategy to improve things was to add a custom shape scale, with alternating empty vs solid point shapes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(Vy, aes(F2, F1, color = Vowel))+ | |
geom_point()+ | |
scale_shape_manual(values = c(5,17,1), breaks = c("iy", "ey","ay"))+ | |
theme_bw()+ | |
scale_x_continuous(trans = revlog_trans())+ | |
scale_y_reverse()+ | |
stat_ellipse(level = 0.95)+ | |
opts(legend.position = "none")+ | |
annotate(geom="text", x=2900, y = 460, label = "iyC", size = 5)+ | |
annotate(geom="text", x=2400, y = 750, label = "eyC", size = 5)+ | |
annotate(geom="text", x=1850, y = 970, label = "ay", size = 5) |
Better, but not great. All the overplotting of the empty point shapes creates this awful indiscriminate mash in the middle of the clusters.
My solution to this problem was to use filled points. While point shapes 1 and 5 in R correspond to an empty circle and an empty diamond, respectively, point shapes 21 and 23 correspond to a filled circle and a filled diamond, respectively, where the fill color and the border color can be different. So, I used shapes 21 and 23 instead of 1 and 5, and set the fill color to be white.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(Vy, aes(F2, F1, color = Vowel))+ | |
geom_point(fill = "white")+ | |
scale_shape_manual(values = c(23,17,21), breaks = c("iy", "ey","ay"))+ | |
theme_bw()+ | |
scale_x_continuous(trans = revlog_trans())+ | |
scale_y_reverse()+ | |
stat_ellipse(level = 0.95)+ | |
opts(legend.position = "none")+ | |
annotate(geom="text", x=2900, y = 460, label = "iyC", size = 5)+ | |
annotate(geom="text", x=2400, y = 750, label = "eyC", size = 5)+ | |
annotate(geom="text", x=1850, y = 970, label = "ay", size = 5) |
I think it's a big improvement. Here's one more iteration, filling the points with a light grey shade instead of white, just for some aesthetic appeal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggplot(Vy, aes(F2, F1, color = Vowel))+ | |
geom_point(fill = "grey80")+ | |
scale_shape_manual(values = c(23,17,21), breaks = c("iy", "ey","ay"))+ | |
theme_bw()+ | |
scale_x_continuous(trans = revlog_trans())+ | |
scale_y_reverse()+ | |
stat_ellipse(level = 0.95)+ | |
opts(legend.position = "none")+ | |
annotate(geom="text", x=2900, y = 460, label = "iyC", size = 5)+ | |
annotate(geom="text", x=2400, y = 750, label = "eyC", size = 5)+ | |
annotate(geom="text", x=1850, y = 970, label = "ay", size = 5) |
No comments:
Post a Comment