require(tidyr) require(ggplot2) require(MuMIn) dfstat <- read.csv(file = 'Processed_data/DF_stat.csv') dfstat$X <- NULL dfstat$Time_vis_touch <- dfstat$Time_visible + dfstat$Time_touching dfstat$Delta_MFO <- dfstat$Mean_fraction_open - dfstat$MFO_bef_crab dfstat <- subset(dfstat, !is.na(dfstat$Time_vis_touch)) p5 <- ggplot(data = dfstat, aes(x=Time_vis_touch, y=Delta_MFO))+ geom_segment(aes(x = min(Time_vis_touch), xend = max(Time_vis_touch), y = (0.12 + -0.5353*min(Time_vis_touch)), yend = (0.12 + -0.5353*max(Time_vis_touch))), color="black", size = 1.2) + geom_segment(aes(x = min(Time_vis_touch), xend = max(Time_vis_touch), y = (0.12 + -0.5353*min(Time_vis_touch)), yend = (0.12 + -0.5353*max(Time_vis_touch))), color="#fbdb72", size = .8) + geom_point(shape = 1)+ ggtitle("Interaction between crab and mussel behaviour") + xlab("Stimulus crab: Fraction of time spent being close and/or touching") + ylab("Mussel: Change in valve gape (\U0394 fraction open)") + theme_bw()+theme(plot.margin = margin(t = 5.5, r = 6.5, b = 5.5, l = 5.5, unit = "pt")) p5 ggsave('Figures_accepted_MS/Figure_5_Interaction.tiff', plot = p5, tiff(), units = 'in', width = 5.2, height = 4.8, dpi = 600) hist(dfstat$Delta_MFO) m1f <- glm(Delta_MFO ~ Time_vis_touch + Treatment + Mussel_size + Crab_size, data = dfstat, na.action = 'na.fail') dredge(m1f, rank = "AICc") m1b <- glm(Delta_MFO ~ Time_vis_touch, data = dfstat, na.action = 'na.fail') #plot(m1b) summary(m1b)