SHARE
TWEET

Untitled

a guest Jul 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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))+
  2.   geom_line(aes(y= mean_act, color= genotype), size = 1.3) +
  3.   labs(title= "genotype_1", # CHANGE TITLE
  4.        subtitle="Baseline",
  5.        caption=NULL,
  6.        y = "Mean Activity (Counts/h)",
  7.        color = NULL) +  # title and caption
  8.   scale_color_manual(labels = c("dodgerblue2" = "Cirl Rescue / Def; UAS dTrp",
  9.                                 "black"= "Cirl Rescue / TH 2M, Def; UAS dTrp",
  10.                                 "grey48"="Cirl Rescue / TH 2M, Def"),
  11.                       values = c("Cirl Rescue / Def; UAS dTrp"="dodgerblue2",
  12.                                  "Cirl Rescue / TH 2M, Def; UAS dTrp"="black",
  13.                                  "Cirl Rescue / TH 2M, Def"="grey48"))+
  14.    geom_errorbar(aes(ymin=mean_act-sem, ymax=mean_act+sem), width=.1,
  15.                 position=position_dodge(0.05))+ # error bars
  16.   theme(legend.position = c(.840,.841))+
  17.   scale_x_hours(name = "Time", breaks = waiver(),
  18.   minor_breaks = NULL, labels = waiver(), limits = hours(c(0,72)), #Or minor breaks = waiver()
  19.   expand = waiver(), oob = scales::censor, na.value = NA_real_,
  20.   position = "bottom", time_wrap = NULL, unit = "h")+ # set x axis scale
  21.   scale_y_continuous(limits = c(0, 1000))+ #adjust y axis
  22.   theme(axis.text.x = element_text(angle = 45, vjust=0.5, size = 12),
  23.         axis.text.y = element_text(size = 12),
  24.         axis.title.x = element_text(size = 12),
  25.         axis.title.y = element_text(size = 12),
  26.         plot.caption = element_text(size = 12),
  27.         legend.position = "bottom",
  28.         legend.text = element_text(size = 12),
  29.         legend.title = element_text(size = 12),
  30.         legend.direction = "vertical",
  31.         legend.box.spacing = unit(.1, "in"),
  32.         legend.box.just = "top")
  33.  
  34.   ggsave("filename_0.png", plot = comp_actplot0, device = "png", width = 7 , height = 5, units = "in")
  35.      
  36. Comp_plot_0mM_5mM<- function(data.frame, genotype_1, genotype_2, genotype_3, x_limit, y_limit, filename_0){
  37.  
  38.  comp_actplot0<- ggplot(data=subset(data.frame, genotype %in% c(genotype_1, genotype_2, genotype_3) & drug_condit %in% "0AMPH") , aes(x= t))+
  39.   geom_line(aes(y= mean_act, color= genotype), size = 1.3) +
  40.   labs(title= genotype_1, # CHANGE TITLE
  41.        subtitle="Baseline",
  42.        caption=NULL,
  43.        y = "Mean Activity (Counts/h)",
  44.        color = NULL) +  # title and caption
  45.   scale_color_manual(labels = c("dodgerblue2" = genotype_1,
  46.                                 "black"= genotype_2,
  47.                                 "grey48"=genotype_3),
  48.                       values = c(genotype_1="dodgerblue2",
  49.                                  genotype_2="black",
  50.                                  genotype_3="grey48"))+
  51.    geom_errorbar(aes(ymin=mean_act-sem, ymax=mean_act+sem), width=.1,
  52.                 position=position_dodge(0.05))+ # error bars
  53.   theme(legend.position = c(.840,.841))+
  54.   scale_x_hours(name = "Time", breaks = waiver(),
  55.   minor_breaks = NULL, labels = waiver(), limits = hours(c(0,x_limit)), #Or minor breaks = waiver()
  56.   expand = waiver(), oob = scales::censor, na.value = NA_real_,
  57.   position = "bottom", time_wrap = NULL, unit = "h")+ # set x axis scale
  58.   scale_y_continuous(limits = c(0, y_limit))+ #adjust y axis
  59.   theme(axis.text.x = element_text(angle = 45, vjust=0.5, size = 12),
  60.         axis.text.y = element_text(size = 12),
  61.         axis.title.x = element_text(size = 12),
  62.         axis.title.y = element_text(size = 12),
  63.         plot.caption = element_text(size = 12),
  64.         legend.position = "bottom",
  65.         legend.text = element_text(size = 12),
  66.         legend.title = element_text(size = 12),
  67.         legend.direction = "vertical",
  68.         legend.box.spacing = unit(.1, "in"),
  69.         legend.box.just = "top")
  70.  
  71.   ggsave(filename_0, plot = comp_actplot0, device = "png", width = 7 , height = 5, units = "in")}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top