require(ggplot2)

library(gridBase)

plot(cos, -pi, 2*pi, ylim = c(-1.3, 1.5), col = "red")

myd <- data.frame (X = 1:10, Y = c(3, 4, 8, 7, 2, 1, 9, 4, 2, 3))

qp <- qplot(X, Y, data=myd) + theme_bw()

print(qp, vp=viewport(.65, .65, .25, .25))

library(lattice)

library(gridBase)

plot.new()

pushViewport(viewport())

set.seed(1234)

xvars <- rnorm(25, 5, 1)

yvars <- rnorm(25, 5, 1)

xyplot(yvars~xvars, xlim = c(0, 10), ylim = c(0, 10) )

pushViewport(viewport(x=.6,y=.85,width=.20,height=.15,just=c("left","top")))

grid.rect()

par(plt = gridPLT(), new=TRUE)

plot(xvars,yvars)

popViewport(2)

library(gridBase)

plot(cos, -pi, 2*pi, ylim = c(-1.3, 1.5), col = "red")

myd <- data.frame (X = 1:10, Y = c(3, 4, 8, 7, 2, 1, 9, 4, 2, 3))

qp <- qplot(X, Y, data=myd) + theme_bw()

print(qp, vp=viewport(.65, .65, .25, .25))

library(lattice)

library(gridBase)

plot.new()

pushViewport(viewport())

set.seed(1234)

xvars <- rnorm(25, 5, 1)

yvars <- rnorm(25, 5, 1)

xyplot(yvars~xvars, xlim = c(0, 10), ylim = c(0, 10) )

pushViewport(viewport(x=.6,y=.85,width=.20,height=.15,just=c("left","top")))

grid.rect()

par(plt = gridPLT(), new=TRUE)

plot(xvars,yvars)

popViewport(2)

## No comments:

## Post a Comment

Note: Only a member of this blog may post a comment.