How would I specify a fixed colorBy so that the class is the same across charts? For example, if I have two charts on a page and I want setosa red, versicolor blue and virginica to green, how would I fix that in advance? I have multiple charts so the class should be the same color in each chart.
# setosa red / versicolor blue
library(canvasXpress)
y=read.table("cX-irist-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
z=read.table("cX-irist-var.txt", header=TRUE, sep= "\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
fn <- data.frame(cbind(y, Species = z), stringsAsFactors=FALSE)
fn1 <- fn[1:90,] # first dataset
fn2 <- fn[91:150,] # second dataset shares 1 class with first
x1 <- fn1[,1:3]
x2 <- subset(fn1,select="Species")
canvasXpress(
data=x1,
varAnnot=x2,
axisTickScaleFontFactor=0.5,
axisTitleScaleFontFactor=0.5,
colorBy="Species",
graphType="Scatter3D",
title="Iris Data Set",
xAxis=list("Sepal.Length"),
yAxis=list("Sepal.Width"),
zAxis=list("Petal.Length")
)
# versicolor red should be blue / virginica blue should be green
x3 <- fn2[,1:3]
x4 <- subset(fn2,select="Species")
canvasXpress(
data=x3,
varAnnot=x4,
axisTickScaleFontFactor=0.5,
axisTitleScaleFontFactor=0.5,
colorBy="Species",
graphType="Scatter3D",
title="Iris Data Set",
xAxis=list("Sepal.Length"),
yAxis=list("Sepal.Width"),
zAxis=list("Petal.Length")
)
I cannot add the tag canvasxpress, but probably should be added - awesome library thank you!