Change color in 3d graphic scatter3
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I need to change the colors of my 3d graphic. The y-axis data are grouped in 3 different groups (y=100, y=75, y=50), and I need each of those three groups to have a different color. My code is as follows:
clear;
pga_x = load('PGA.txt'); %textfile (115 data)
clt_y= load('CLT.txt'); %textfile (y=100, y=75, y=50)
energia_z=load('ENERGIA_ME.txt'); %textfile (115 data)
%c1_z= energia_z(:,1);
%c2_z= energia_z(:,2);
%c3_z= energia_z(:,3);
%c4_z= energia_z(:,4);
[xdata, ydata, zdata] = prepareSurfaceData(pga_x, clt_y, energia_z);
a = scatter3(xdata,ydata,zdata);
legend( a, 'Ajuste de curva Lineal', '%CLT vs. PGA(g), Energía embebida(MJ)', 'Location', 'NorthEast' );
xlabel('PGA (g)');
ylabel('%CLT');
zlabel('ENERGÍA EMBEBIDA (MJ)');
I appreciate if you can help me. My English is not very good, I speak Spanish and use translator.
I need it to look like in the following image, each group with a different color. Please help :'(
댓글 수: 0
답변 (1개)
KSSV
2022년 10월 21일
You need to provide the color data.
a = scatter3(xdata,ydata,zdata,[],zdata,'filled');
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!