celestialgod

panel_iloveu

Jul 3rd, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.08 KB | None | 0 0
  1. library(lattice)
  2. library(latticeExtra)
  3.  
  4. dat = data.frame(x = 4, y = -2)
  5. panel_iloveu = function(...){
  6.   panel.xyplot(...)
  7.   panel.curve(3+sqrt(1-(x+1)^2), -2, 0, lwd = 2)
  8.   panel.curve(3-sqrt(1-(x+1)^2), -2, 0, lwd = 2)
  9.   panel.curve(-2*x+6, 1, 2, lwd = 2)
  10.   panel.curve(2*x-2, 2, 3, lwd = 2)
  11.   panel.curve(3+sqrt(1-(x-5)^2), 4, 6, lwd = 2)
  12.   panel.curve(3-sqrt(1-(x-5)^2), 4, 5.6, lwd = 2)
  13.   panel.curve(-2*x-8, -4, -3, lwd = 2)
  14.   panel.curve(2*x+4, -4, -2, lwd = 2)
  15.   panel.curve(-1+sqrt(1-x^2), -1, 1, lwd = 2)
  16.   panel.curve(-1-sqrt(1-x^2), -1, 1, lwd = 2)
  17.   panel.curve(8/9*x^2-44/9*x+85/18, 2, 3.5, lwd = 2)
  18.   panel.curve(0*x+6, -7, -5, lwd = 2)
  19.   panel.curve(0*x+2, -7, -5, lwd = 2)
  20.   panel.curve(0*x+3, 4, 6, lwd = 2)
  21.   panel.lines(c(-3,-3),c(2,6), lwd = 2)
  22.   panel.lines(c(-6,-6),c(2,6), lwd = 2)
  23.   panel.lines(c(2,2),c(-1.5,0), lwd = 2)
  24.   panel.lines(c(3.5,3.5),c(-2,0), lwd = 2)
  25. }
  26.  
  27. xyplot(y ~ x, dat, panel = panel_iloveu,  
  28.   aspect = 1/1.6, par.settings = ggplot2like(),
  29.   lattice.options = ggplot2like.opts(),
  30.   xlab = "", ylab = "", xlim = c(-8,8), ylim = c(-4, 6))
Advertisement
Add Comment
Please, Sign In to add comment