Label each data points?

4 visualizaciones (últimos 30 días)
steamrice
steamrice el 12 de Mzo. de 2020
Comentada: Walter Roberson el 29 de Abr. de 2020
Hello there,
I have a .xls file that contains x,y,z vertics. The sequence goes something like this (that header of each): x0,y0,z0,x1,y2,z2,..........x1000,y1000,z1000 (1000data points for each x,y,z). I am wondering is it possible to use scratter3 to plot the points with its label (x0,y0,z0,x1,y2,z2,..........x1000,y1000,z1000) so I can identity/access that particular point?
Many thanks!

Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Mzo. de 2020
scatter3 cannot do labels.
You can text() and pass it vectors of x y z and a cell array of character vectors that are corresponding labels or a string array. For example string(1:1000).'
  37 comentarios
steamrice
steamrice el 14 de Mzo. de 2020
I commented the for loop I had
Walter Roberson
Walter Roberson el 14 de Mzo. de 2020
I would recommend starting by removing the
clc;clear all; close all

Iniciar sesión para comentar.

Más respuestas (1)

steamrice
steamrice el 15 de Mzo. de 2020
Sorry for the late reply! I tried that and still got the same result..
  3 comentarios
steamrice
steamrice el 26 de Abr. de 2020
Sorry for left you hanged. I was working on the other project. The below code from you suggested eailer work!
clc;clear all;
[num,txt,raw] = xlsread('test_april24.csv'); %change the excel file name when received the new one
for i = 2:3:3002-2
a = num(3,i);
b = num(3,i+1);
c = num(3,i+2);
k=scatter3(a,b,c, 'filled');
S=string(1:3662).';
text(a, b, c, S);
row = dataTipTextRow('Index: ',i');
k.DataTipTemplate.DataTipRows(end+1) = row;
hold on
end
The label also showing the the point. However, if I can ask one more question, from what I understand, the 3D plot I am seeing and each point is coming from each x,y,z (x1,y1,z1 forms a point). And the label is showing the total point 3002. Is there a way to group the index point? (x1,y1,z1 would label as index 1and x3000,y3000,z3000 would label as 1500)?
I have been trying to modifiy this line,
row = dataTipTextRow('Index: ',i');
to somthing like
index=1:1500
row = dataTipTextRow('Index: ',index');
But it would only shows index as all 1 (i think it did not work if I do that inside the for loop..)
Sorry my thought process is a bit messy..
Walter Roberson
Walter Roberson el 29 de Abr. de 2020
row = dataTipTextRow('Index: ',i/2);
perhaps?

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by