if (!("ggplot2" %in% installed.packages())) {
install.packages('ggplot2')
}
library('ggplot2')
if (!("devtools" %in% installed.packages())) {
install.packages('devtools')
}
if (!("canvasXpress" %in% installed.packages())) {
devtools::install_github('neuhausi/canvasXpress')
}
#devtools::install_local("~/git/canvas/R/canvasXpress.tar.gz", build_manual = TRUE, upgrade = "always")
library('canvasXpress')
This demo shows the ability to create facets with CanvasXpress through ggplot.
w <- ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_wrap(~class, ncol = 3)
w
canvasXpress(w)
g <- ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_grid(. ~cyl)
g
canvasXpress(g)
g2 <- ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_grid(drv ~ .)
g2
canvasXpress(g2)
g3 <- ggplot(mpg, aes(displ, hwy)) + geom_point() + facet_grid(drv ~ cyl)
g3
canvasXpress(g3)
mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00))
g4 <- ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_wrap(~ cyl) + geom_hline(aes(yintercept = wt), mean_wt)
g4
canvasXpress(g4)
###ggplot
mean_wt <- data.frame(cyl = c(4, 6, 8), wt = c(2.28, 3.11, 4.00))
g5 <- ggplot(mtcars, aes(mpg, wt, colour = wt)) + geom_point() + geom_hline(aes(yintercept = wt, colour = wt), mean_wt) + facet_wrap(~ cyl)
g5