Short Examples


library(RJSplot)
# Create a boxplot
boxplot_rjs(attitude, "attitude", "favourable responses")

boxplot

# Create a barplot
barplot_rjs(USArrests, "states", "arrests")

barplot

# Generate test input data
data <- data.frame(Uni05 = (1:100)/21, Norm = rnorm(100), `5T` = rt(100, df = 5), Gam2 = rgamma(100, shape = 2))

# Create a density plot
densityplot_rjs(data, "x", "y")

densityplot

# Create a scatter plot
scatterplot_rjs(iris[["Sepal.Width"]], iris[["Sepal.Length"]], abline.x = c(3.4,3.8), abline.y = c(5.8,7), col = iris[["Species"]], pch = as.numeric(iris[["Species"]]), id = iris[["Species"]], xlab = "Sepal Width (cm)", ylab = "Sepal Length (cm)")

scatterplot

# Create a pie chart
piechart_rjs(VADeaths)

piechart

# Create a bubble plot
bubbles_rjs(scale(mtcars[,c("mpg","hp")],FALSE), mtcars[["wt"]])

bubbleplot

# Create a dendrogram
dendrogram_rjs(dist(USArrests),USArrests)

dendrogram

# Prepare data
x <- 1-cor(t(mtcars))

source <- rep(rownames(x),nrow(x))
target <- rep(rownames(x),rep(ncol(x),nrow(x)))
links <- data.frame(source=source,target=target,value=as.vector(x))
# Create a network graph
network_rjs(links[links[,3]>0.1,], mtcars, group = "cyl", size = "hp", color = "mpg")

network

# Create a symetric heatmap
symheatmap_rjs(links, mtcars, group = "cyl")

symheatmap

# Create a hive plot
hiveplot_rjs(links, mtcars, group = "cyl", size = "wt", color = "carb")

hiveplot

# Generation of metadata test
metadata <- data.frame(phenotype1 = sample(c("yes","no"),ncol(mtcars),TRUE), phenotype2 = sample(1:5,ncol(mtcars),TRUE))

# Create a heatmap
heatmap_rjs(data.matrix(mtcars), metadata, scale="column")

heatmap

# Format test data
words <- data.frame(word = rownames(USArrests), freq = USArrests[,4])

# Create WordCloud
wordcloud_rjs(words)

wordcloud

# Create test data
chr <- character()
pos <- numeric()

for(i in 1:nrow(GRCh38)){
  chr <- c(chr,as.character(rep(GRCh38[i,"chr"],100)))
  pos <- c(pos,sample(GRCh38[i,"start"]:GRCh38[i,"end"],100))
}

value <- round(rexp(length(pos)),2)
# Create a manhattan plot
data <- data.frame(paste0("ProbeSet_",seq_along(pos)),chr,pos,value)
manhattan_rjs(data, GRCh38, 0, 1, 0, TRUE, "log2Ratio")

manhattan

# Create a genome map
track <- data.frame(chr,pos,pos+1,NA,value)
genomemap_rjs(GRCh38.bands, track)

genomemap

# Create a 3D scatter plot
scatter3d_rjs(iris[["Sepal.Width"]], iris[["Sepal.Length"]], iris[["Petal.Width"]], color = iris[["Species"]], xlab = "Sepal Width (cm)", ylab = "Sepal Length (cm)", zlab = "Petal Width (cm)")

scatter3d

# Create a 3D surface
surface3d_rjs(volcano,color=c("red","green"))

surface3d

# Create a data table
tables_rjs(swiss)

datatables