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')
Simple scatter plot
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_text()
g

canvasXpress(g)
Change the size of the texts
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_text(size=6)
g

canvasXpress(g)
Change vertical and horizontal adjustement
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_point() + geom_text(hjust=0, vjust=0)
g

canvasXpress(g)
Change fontface. Allowed values : 1(normal), 2(bold), 3(italic),
4(bold.italic)
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_point() + geom_text(aes(fontface=2))
g

canvasXpress(g)
geom_label()
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_point() + geom_label()
g

canvasXpress(g)
geom_label()
g <- ggplot(df, aes(wt, mpg, label = rownames(df))) + geom_point() + geom_label(aes(fill = factor(cyl)), colour = "white", fontface = "bold")
g

canvasXpress(g)
Color by groups
g <- ggplot(mtcars, aes(x=wt, y=mpg, label=rownames(mtcars))) + geom_point() + geom_text(aes(color=factor(cyl)))
g
