I'm very new to R and I hope this question is still interesting enough. I have the following dataframe:
> dput(df)
structure(list(Proportion = c(0.491475825983558, 0.624947117938639,
0.284285973983444, 0.459936074937072, 0.438167575182789, 0.5923527,
0.269347638359089, 0.444195335296524, 0.472343382529259, 0.6119936,
0.280545311041942, 0.45582336843016), Lower = c(0.373501802431026,
0.506815311121949, 0.196793171052086, 0.344394223066228, 0.342020291619279,
0.4962054, 0.197239652248339, 0.347543569904938, 0.362690139261045,
0.5158463, 0.198654362934906, 0.347479674558168), Upper = c(0.610508712286318,
0.729864865043791, 0.39179224043653, 0.580031198686217, 0.539194328764963,
0.6885, 0.356122647401151, 0.545263076314964, 0.5847316572176,
0.7081409, 0.380178492952045, 0.56851602179505), Area = c("SNP",
"SNP", "LGCA", "LGCA", "SNP", "SNP", "LGCA", "LGCA", "SNP", "SNP",
"LGCA", "LGCA"), Time = c("Day", "Night", "Day", "Night", "Day",
"Night", "Day", "Night", "Day", "Night", "Day", "Night"), Collar = c(41361,
41361, 41361, 41361, 41365, 41365, 41365, 41365, 41366, 41366,
41366, 41366)), row.names = c(NA, -12L), class = c("tbl_df",
"tbl", "data.frame"))
For which I have created the following plot:
Using the script below:
dfnew <- df %>%
mutate(ymin = Proportion - Lower,
ymax = Proportion + Upper)
p <- ggplot(data = dfnew, aes(x = Time, y = Proportion, color=Area, group=Area)) +
geom_point(size = 6, stroke = 0, shape = 16,
position = position_dodge(width = 0.1))+
geom_errorbar(aes(ymin = Lower, ymax = Upper), width=0.1, size=1,
position = position_dodge(width = 0.1)) +
theme(axis.text=element_text(size=15),
axis.title=element_text(size=20)) +
scale_color_manual(values = c("SNP" = "coral",
"LGCA" = "darkgoldenrod2")) +
geom_line(size=1,linetype="dotted")
p
I would like plot different symbols (e.g. ∆, O, ◊) accounting for the different collars in df
. Also, I would like these to be moved slightly (position_dodge
) so that not all points are on top of each other.
How can I access a symbol library and implement it into my script?
Any help would be very appreciated!