Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library("ggplot2")
- rowSubscripts = sample(nrow(diamonds),1000)
- kdiamonds <- diamonds[rowSubscripts,]
- head(kdiamonds)
- summary(kdiamonds)
- tgp <- ggplot(diamonds,
- aes(x=carat,
- y=table,
- color=color,
- group=color
- )) +
- geom_point() +
- opts(axis.title.y=theme_blank(),
- strip.text.y=theme_text())
- tgp
- tgpf<- tgp + facet_grid(color ~ .,
- scales = "free_x",
- space = "fixed",
- margins = F,
- labeller="label_parsed") +
- geom_smooth(method = lm) +
- opts(strip.background = theme_blank()) +
- opts(strip.text.y = theme_blank()) +
- opts(axis.title.x=theme_blank())
- tgpf
- pdf("facetLabels.pdf", width = 4, height = 8)
- grid.newpage()
- pushViewport(viewport(layout = grid.layout(2,1)))
- vplayout <- function(x,y)
- viewport(layout.pos.row = x, layout.pos.col = y)
- print(tgpf, vp = vplayout(1,1))
- print(tgp, vp =vplayout(2,1))
- dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement