Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- comp_actplot0<- ggplot(data=subset(mean.act.dt, genotype %in% c("Cirl Rescue / Def; UAS dTrp", "Cirl Rescue / TH 2M, Def; UAS dTrp", "Cirl Rescue / TH 2M, Def") & drug_condit %in% "0AMPH") , aes(x= t))+
- geom_line(aes(y= mean_act, color= genotype), size = 1.3) +
- labs(title= "genotype_1", # CHANGE TITLE
- subtitle="Baseline",
- caption=NULL,
- y = "Mean Activity (Counts/h)",
- color = NULL) + # title and caption
- scale_color_manual(labels = c("dodgerblue2" = "Cirl Rescue / Def; UAS dTrp",
- "black"= "Cirl Rescue / TH 2M, Def; UAS dTrp",
- "grey48"="Cirl Rescue / TH 2M, Def"),
- values = c("Cirl Rescue / Def; UAS dTrp"="dodgerblue2",
- "Cirl Rescue / TH 2M, Def; UAS dTrp"="black",
- "Cirl Rescue / TH 2M, Def"="grey48"))+
- geom_errorbar(aes(ymin=mean_act-sem, ymax=mean_act+sem), width=.1,
- position=position_dodge(0.05))+ # error bars
- theme(legend.position = c(.840,.841))+
- scale_x_hours(name = "Time", breaks = waiver(),
- minor_breaks = NULL, labels = waiver(), limits = hours(c(0,72)), #Or minor breaks = waiver()
- expand = waiver(), oob = scales::censor, na.value = NA_real_,
- position = "bottom", time_wrap = NULL, unit = "h")+ # set x axis scale
- scale_y_continuous(limits = c(0, 1000))+ #adjust y axis
- theme(axis.text.x = element_text(angle = 45, vjust=0.5, size = 12),
- axis.text.y = element_text(size = 12),
- axis.title.x = element_text(size = 12),
- axis.title.y = element_text(size = 12),
- plot.caption = element_text(size = 12),
- legend.position = "bottom",
- legend.text = element_text(size = 12),
- legend.title = element_text(size = 12),
- legend.direction = "vertical",
- legend.box.spacing = unit(.1, "in"),
- legend.box.just = "top")
- ggsave("filename_0.png", plot = comp_actplot0, device = "png", width = 7 , height = 5, units = "in")
- Comp_plot_0mM_5mM<- function(data.frame, genotype_1, genotype_2, genotype_3, x_limit, y_limit, filename_0){
- comp_actplot0<- ggplot(data=subset(data.frame, genotype %in% c(genotype_1, genotype_2, genotype_3) & drug_condit %in% "0AMPH") , aes(x= t))+
- geom_line(aes(y= mean_act, color= genotype), size = 1.3) +
- labs(title= genotype_1, # CHANGE TITLE
- subtitle="Baseline",
- caption=NULL,
- y = "Mean Activity (Counts/h)",
- color = NULL) + # title and caption
- scale_color_manual(labels = c("dodgerblue2" = genotype_1,
- "black"= genotype_2,
- "grey48"=genotype_3),
- values = c(genotype_1="dodgerblue2",
- genotype_2="black",
- genotype_3="grey48"))+
- geom_errorbar(aes(ymin=mean_act-sem, ymax=mean_act+sem), width=.1,
- position=position_dodge(0.05))+ # error bars
- theme(legend.position = c(.840,.841))+
- scale_x_hours(name = "Time", breaks = waiver(),
- minor_breaks = NULL, labels = waiver(), limits = hours(c(0,x_limit)), #Or minor breaks = waiver()
- expand = waiver(), oob = scales::censor, na.value = NA_real_,
- position = "bottom", time_wrap = NULL, unit = "h")+ # set x axis scale
- scale_y_continuous(limits = c(0, y_limit))+ #adjust y axis
- theme(axis.text.x = element_text(angle = 45, vjust=0.5, size = 12),
- axis.text.y = element_text(size = 12),
- axis.title.x = element_text(size = 12),
- axis.title.y = element_text(size = 12),
- plot.caption = element_text(size = 12),
- legend.position = "bottom",
- legend.text = element_text(size = 12),
- legend.title = element_text(size = 12),
- legend.direction = "vertical",
- legend.box.spacing = unit(.1, "in"),
- legend.box.just = "top")
- ggsave(filename_0, plot = comp_actplot0, device = "png", width = 7 , height = 5, units = "in")}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement