Change color in 3d graphic scatter3
3 ビュー (過去 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!