Display the Vertex and Triangle labels on the plot

6 visualizaciones (últimos 30 días)
developer
developer el 2 de Sept. de 2011
Hello, As in 2D data we can label the vertex and triangle through the code : triplot(dt);
%Display the Vertex and Triangle labels on the plot
>>hold on
>>vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:10)');
>>Hpl = text(x, y, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...
'center', 'BackgroundColor', 'none');
>>ic = incenters(dt);
>>numtri = size(dt,1);
>>trilabels = arrayfun(@(x) {sprintf('T%d', x)}, (1:numtri)');
>>Htl = text(ic(:,1), ic(:,2), trilabels, 'FontWeight', 'bold', ...
'HorizontalAlignment', 'center', 'Color', 'blue');
>>hold off
How can i label it for 3d points?

Respuestas (1)

Walter Roberson
Walter Roberson el 2 de Sept. de 2011
text() can take x, y, z coordinates.
  1 comentario
developer
developer el 5 de Sept. de 2011
i modify the above code for x,y and z as:
vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:20)');
Hpl = text(x, y,z, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...
'center', 'BackgroundColor', 'none');
ic = incenters(dt);
numtri = size(dt,1);
trilabels = arrayfun(@(z) {sprintf('T%d',z)}, (1:numtri)');
Htl = text(ic(:,1), ic(:,2), ic(:,3), trilabels, 'FontWeight', 'bold', ...
'HorizontalAlignment', 'center', 'Color', 'blue');
Doing so i am points labelled properly but the triangles are not labeled properly

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by