error with changing color of marker using scatter3
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Star Strider
2022년 1월 21일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!