Advertisement
Guest User

Untitled

a guest
May 30th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 3.30 KB | None | 0 0
  1. require(tidyverse)
  2.  
  3. d1 <- read_csv2("data1.csv")
  4. d2 <- read_csv2("data2.csv")
  5. d3 <- read_csv2("data3.csv")
  6. d4 <- read_csv2("data4.csv")
  7. d5 <- read_csv2("data5.csv")
  8. d6 <- read_csv2("data6.csv")
  9. d7 <- read_csv2("data7.csv")
  10. d8 <- read_csv2("data8.csv")
  11. d9 <- read_csv2("data9.csv")
  12. d10 <- read_csv2("data10.csv")
  13.  
  14. d10 <- d10 %>%
  15.   filter(!is.infinite(z))
  16.  
  17. good_plot <- function(df) {
  18.   ggplot()+
  19.     geom_path(data = df,aes(x = x,y = y, colour = "Victim")+
  20.     geom_path(data = df,aes(x = x,y = z, colour = "Predator"))+
  21.     scale_colour_manual(name = "Population",
  22.                         values = c(Victim = "red",Predator = "green"))
  23. }
  24.  
  25. cycle_plot_y <- function(df) {
  26.   ggplot()+
  27.     geom_path(data = df,aes(x = y,y = yd), color = "blue")
  28. }
  29.  
  30. cycle_plot_z <- function(df) {
  31.   ggplot()+
  32.     geom_path(data = df,aes(x = z,y = zd), color = "blue")
  33. }
  34.  
  35. save_plot <- function(df,name){
  36.   res <- ggplot()+
  37.     geom_path(data = df,aes(x = x,y = y, colour = "Victim"))+
  38.     geom_path(data = df,aes(x = x,y = z, colour = "Predator"))+
  39.     scale_colour_manual(name = "Population",
  40.                         values = c(Victim = "red",Predator = "green"))
  41.   ggsave(filename = name,res)
  42. }
  43.  
  44.  
  45. ggplot()+
  46.   geom_path(data = d1,aes(x = x,y = y), color = "blue")+
  47.   geom_path(data = d2,aes(x = x,y = y), color = "red")+
  48.   geom_path(data = d3,aes(x = x,y = y), color = "orange")+
  49.   geom_path(data = d4,aes(x = x,y = y), color = "green")+
  50.   geom_path(data = d5,aes(x = x,y = y), color = "pink")+
  51.   geom_path(data = d6,aes(x = x,y = y), color = "purple")+
  52.   geom_path(data = d7,aes(x = x,y = y), color = "wheat")+
  53.   geom_path(data = d8,aes(x = x,y = y), color = "purple")+
  54.   geom_path(data = d9,aes(x = x,y = y), color = "khaki1")+
  55.   geom_path(data = d10,aes(x = x,y = y), color = "black")+
  56.   xlab("x")+ylab("y")
  57.  
  58.  
  59. good_plot(d1)
  60. save_plot(d1,"plot1.jpg")
  61.  
  62.  
  63. good_plot(d2)
  64. save_plot(d2,"plot2.jpg")
  65. cycle_plot_y(d2)
  66. cycle_plot_z(d2)
  67.  
  68. good_plot(d3)
  69. save_plot(d3,"plot3.jpg")
  70. cycle_plot_y(d3)
  71. cycle_plot_z(d3)
  72.  
  73. good_plot(d4)
  74. save_plot(d4,"plot4.jpg")
  75. cycle_plot_y(d4)
  76. cycle_plot_z(d4)
  77.  
  78. good_plot(d5)
  79. save_plot(d5,"plot5.jpg")
  80.  
  81.  
  82. good_plot(d6)
  83. save_plot(d6,"plot6.jpg")
  84.  
  85. good_plot(d7)
  86. save_plot(d7,"plot7.jpg")
  87.  
  88. good_plot(d8)
  89. save_plot(d8,"plot8.jpg")
  90.  
  91.  
  92. good_plot(d10)
  93. cycle_plot(d9)
  94.  
  95.  
  96. good_plot(d10)
  97. cycle_plot(d10)
  98.  
  99. cycle_plot(d1)
  100. cycle_plot(d2)
  101. cycle_plot(d3)
  102. cycle_plot(d4)
  103.  
  104.  
  105. s1 <- read_csv2("second0.csv")
  106. s2 <- read_csv2("second1.csv")
  107. s3 <- read_csv2("second2.csv")
  108. s4 <- read_csv2("second3.csv")
  109. s5 <- read_csv2("second4.csv")
  110. s6 <- read_csv2("second5.csv")
  111. s7 <- read_csv2("second6.csv")
  112. s8 <- read_csv2("second7.csv")
  113. s9 <- read_csv2("second8.csv")
  114. s10 <- read_csv2("second9.csv")
  115.  
  116.  
  117. good_plot(s1)
  118. save_plot(s1,"splot1.jpg")
  119.  
  120. good_plot(s2)
  121. save_plot(s2,"splot2.jpg")
  122.  
  123. good_plot(s3)
  124. save_plot(s3,"splot3.jpg")
  125.  
  126. cycle_plot_y(s3)
  127. cycle_plot_z(s3)
  128.  
  129.  
  130. good_plot(s4)
  131. save_plot(s4,"splot4.jpg")
  132.  
  133. good_plot(s5)
  134. save_plot(s5,"splot5.jpg")
  135.  
  136. good_plot(s6)
  137. save_plot(s6,"splot6.jpg")
  138. cycle_plot_y(s6)
  139. cycle_plot_z(s6)
  140.  
  141. good_plot(s7)
  142. save_plot(s7,"splot7.jpg")
  143.  
  144. good_plot(s8)
  145. save_plot(s8,"splot8.jpg")
  146.  
  147. good_plot(s9)
  148. save_plot(s9,"splot9.jpg")
  149. cycle_plot_y(s9)
  150. cycle_plot_z(s9)
  151.  
  152.  
  153. good_plot(s10)
  154. save_plot(s10,"splot10.jpg")
  155. cycle_plot_y(s10)
  156. cycle_plot_z(s10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement