celestialgod

panel_iloveu_cht

Jul 4th, 2015
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.30 KB | None | 0 0
  1. library(lattice)
  2. library(latticeExtra)
  3.  
  4. dat = data.frame(x = 20, y = 0)
  5. panel_iloveu_cht = function(...){
  6.   panel.xyplot(...)
  7.   panel.curve(-x+6.5, 2.8, 3.5, lwd = 20)
  8.   panel.curve(x+6, 2, 4, lwd = 20)
  9.   panel.curve(x/3+11.5/3, 2, 4.5, lwd = 20)
  10.   panel.curve(0*x+7, 2, 8, lwd = 20)
  11.   panel.lines(c(3.5,3.5),c(3,9.5), lwd = 20)
  12.   panel.curve(0.6*x^2-10.3*x+46.5, 5, 7.5, lwd = 20)
  13.   panel.curve(2*x^2-28.5*x+110, 6.5, 7, lwd = 20)
  14.   panel.curve(0.4*x^2-3.8*x+12, 5, 7.5, lwd = 20)
  15.   panel.curve(3.5*x-23.5, 7.6, 7.7, lwd = 20)
  16.   panel.lines(c(20,20),c(3,9.5), lwd = 20)
  17.   panel.lines(c(22,22),c(8,10.5), lwd = 20)
  18.   panel.curve(0*x+9.5, 22, 26, lwd = 20)
  19.   panel.lines(c(26,26),c(8,9.5), lwd = 20)
  20.   panel.lines(c(24,24),c(3,9.5), lwd = 20)
  21.   panel.curve(x-10.5, 18, 20.5, lwd = 20)
  22.   panel.curve(2*x-38.5, 21.5, 22.5, lwd = 20)
  23.   panel.curve(-2*x+57.5, 25.5, 26.5, lwd = 20)
  24.   panel.curve(-2*x/3+19, 23, 24, lwd = 20)
  25.   panel.curve(5.2+(8*abs(x-13)+15*sqrt(17-(x-13)^2))/17, 7, 19, lwd = 20, col = "red")
  26.   panel.curve(6.1+(8*abs(x-13)-15*sqrt(17-(x-13)^2))/17, 7, 19, lwd = 20, col = "red")
  27. }
  28.  
  29. xyplot(y ~ x, dat, panel = panel_iloveu_cht,  
  30.   aspect = 9/26, par.settings = ggplot2like(),
  31.   lattice.options = ggplot2like.opts(),
  32.   xlab = "", ylab = "", xlim = c(1,27), ylim = c(2, 11))
Advertisement
Add Comment
Please, Sign In to add comment