Here's a subset of data.
structure(list(Transmitter = c(1675L, 1675L, 1675L, 1675L, 1681L,
1681L, 1681L, 1681L, 1685L, 1685L, 1685L, 1685L, 1685L, 9782L,
9782L, 9782L, 24166L, 24166L, 24166L, 24166L, 24184L, 24184L,
24184L, 24184L), Date = structure(c(17392, 17721, 17722, 17393,
17734, 17729, 17391, 17717, 17392, 17390, 17391, 17381, 17382,
18079, 18110, 17762, 17751, 18097, 18090, 18091, 18097, 18068,
18082, 18088), class = "Date"), Year = c(2017L, 2018L, 2018L,
2017L, 2018L, 2018L, 2017L, 2018L, 2017L, 2017L, 2017L, 2017L,
2017L, 2019L, 2019L, 2018L, 2018L, 2019L, 2019L, 2019L, 2019L,
2019L, 2019L, 2019L), DirectionGroups = structure(c(3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L), .Label = c("Both", "Marine", "River"), class = "factor")), row.names = c(355L,
356L, 357L, 358L, 475L, 476L, 477L, 478L, 530L, 531L, 532L, 533L,
534L, 573L, 574L, 575L, 626L, 627L, 628L, 629L, 764L, 765L, 766L,
767L), class = "data.frame")
I'm trying to create a scatterplot of individually tagged animals through time. Points are colored by the group I have put them in. Currently the scatterplot is sorted by the level of the Transmitter. Instead I would like a way to sort these data by the DirectionGroup.
Here is my current scatterplot.
ggplot(data = AbPlot3, aes(x = Date, y = factor(Transmitter), color = DirectionGroups)) + geom_point()+theme_bw()+ylab("Transmitter")+
scale_color_manual(values = c('grey40', 'black', 'grey70'), labels = c('Transient', 'External', 'Resident'))+
theme(axis.text.y = element_blank(), axis.title = element_text(size = 16),
axis.text.x = element_text(size = 14), legend.text = element_text(size = 14),
legend.title = element_text(size = 16))
Essentially, I want one plot with all Transient points next to each other, all external points together and all resident points together.