error with changing color of marker using scatter3
3 views (last 30 days)
Show older comments
I want to create a 3D scatter plot using different colors for each marker, which is information contained in rgb. I keep getting errors, and I can't figure out what is going on!
I checked that the dimensions of Table are 50x4 and that rgb is 50x3 with numbers only 0-1. I tried a test using this "colorvector" and that also did not work, so I don't think it is something to do with the file.
Table = readtable(DataFilePath);
Map = [Table.Var2/360, Table.Var3/100, Table.Var4/100];
rgb = hsv2rgb(Map);
%Colorvector= repmat([0,1,1],height(Table),1);
scatter3(Table,"Var2", "Var3", "Var4", 15, rgb);
It generates the scatter of just Table and the variables with no other modifications , but I can't get any color modifications to work. The error message is "Error using scatter3 (line 57) Invalid parameter/value pair arguments. Error in ScatterplotAttempt1 (line 16) , scatter3(Table,"Var2", "Var3", "Var4",15, rgb );"
0 Comments
Answers (1)
Star Strider
on 21 Jan 2022
This is the best I cand o.
Table = table(rand(10,1),rand(10,1),rand(10,1),rand(10,1))
Map = [Table.Var2/360, Table.Var3/100, Table.Var4/100];
rgb = hsv2rgb(Map);
%Colorvector= repmat([0,1,1],height(Table),1);
figure
hs3 = scatter3(Table, 'Var2', 'Var3', 'Var4','filled', 'ColorVariable','Var4');
hs3.SizeData = 15;
colormap(rgb)
colorbar
..
0 Comments
See Also
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!