Getting colors using RGB values w/ scatter3

25 次查看(过去 30 天)
I am trying to get grey colored plot points on my 3D scatter plot, I am unfamiliar with scatter3. From the error messages I am getting using the conventional method (on a regular plot, shown below) - I am assuming there should be an established color vector.
This is what I have currently
scatter3(X,Y,Z,'filled', c, [17 17 17]);

采纳的回答

Adam Danz
Adam Danz 2019-7-16
编辑:Adam Danz 2019-7-16
rgb triplets are normalized between 0:1
To convert from decimal code, divide by 255.
[17,17,17]./255
% equals
[ 0.066667 0.066667 0.066667]
The color gray is
% RGP TRIPLE %CSS3 proposed standard name: https://www.w3.org/TR/css-color-3/
[0.5 0.5 0.5] %gray
[0.82422 0.82422 0.82422] %light gray
[0.75 0.75 0.75] %silver
[ 0.66016 0.66016 0.66016] %dark gray
[0.14844 0.14844 0.14844] %mine shaft
[ 0.4375 0.5 0.5625] %slate gray
See the rgb() function on the file exchange for RGB triplets to many different colors.
To apply that to scatter3; here's how to color all points gray and filled.
scatter3(x,y,z,[],[.5,.5,.5],'filled')
  4 个评论
Hans123
Hans123 2019-7-16
works perfectly.
thanks for the link too, really appreciate it

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by