简体   繁体   English

使用R更改Canvasxpress中Scatter3d的颜色

[英]Change Color of Scatter3d in Canvasxpress using R

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. 在该网站的第一个示例( https://cran.r-project.org/web/packages/canvasXpress/vignettes/getting_started.html#scatter-3d-plot )中,有一个使用R用canvasxpress软件包制作的3d散点图。

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')一个参数,例如:

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... 我试图更改生成的html的菜单栏中...特别是关于colors参数(设置RGB颜色的新数组),然后按ctrl + alt + R重现更改...但是什么也没有发生...

Any thoughts about it? 有什么想法吗?

Thanks 谢谢

Pass in a colorKey: 传递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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM