0

In the first example of this website (https://cran.r-project.org/web/packages/canvasXpress/vignettes/getting_started.html#scatter-3d-plot), there's a 3d scatterplot made with canvasxpress package using R.

Just copying and pasting the code you can easily get the results on the example...

data <- t(iris[,1:4])
varAnnot <- as.matrix(iris[,5])
colnames(varAnnot) <- "Species"
canvasXpress(t(data), varAnnot=varAnnot, graphType='Scatter3D', colorBy='Species')

I'm wondering if there's a way to pass within the canvasXpress(t(data), varAnnot=varAnnot, graphType='Scatter3D', colorBy='Species') an argument like:

canvasXpress(t(data), varAnnot=varAnnot, graphType='Scatter3D', colorBy='Species', colors="rgb(153,204,255)","rgb(204,102,0)","rgb(153,76,0)","rgb(169,131,7)","rgb(153,255,153)","rgb(105,150,150)","rgb(183,120,68)","rgb(131,172,208)","rgb(194,224,118)","rgb(250,220,90)","rgb(255,84,159)","rgb(255,175,84)","rgb(154,184,183)","rgb(210,166,131)","rgb(61,105,155)","rgb(135,172,34)","rgb(205,169,8)","rgb(208,33,88)","rgb(208,115,0)","rgb(86,118,118)")

In order to change the colors of the points in the graph...

I've tried to change in the menubar of the html generated...specifically on colors arguments (setting a new array of RGB colors), and then ctrl + alt + R to reproduce the changes...but nothing happened...

Any thoughts about it?

Thanks

guidebortoli
  • 659
  • 3
  • 8
  • 16

1 Answers1

0

Pass in a colorKey:

colorKey = list("Species"=list("setosa"="gold","versicolor"="silver","virginica"="red"))

and then call:

data <- t(iris[,1:4])
varAnnot <- as.matrix(iris[,5])
colnames(varAnnot) <- "Species"
canvasXpress(t(data), 
    varAnnot=varAnnot, 
    graphType='Scatter3D', 
    colorBy='Species', 
    colorKey=colorKey)
calycolor
  • 726
  • 1
  • 7
  • 19