# 3D plot from vertex and face list with vertex index labels, using matlab

## Alec Jacobson

## February 15, 2010

I've had to rediscover how this is done in matlab too many times, so here it is to be remembered. If you have a triangle mesh with 3d vertex positions V (number of vertices by 3 ) and face list F (number of faces by 3) you can plot and label using:
```
figure;trisurf( F,V(:,1), V(:,2),V(:,3));view(2);
text(V(:,1),V(:,2),V(:,3),num2str((1:size(V,1))'));
```

If your V's are actual 2d (number of vertices by 2) and you just want to plot your two dimensional domain on a plane the use:
```
figure;trisurf( F,V(:,1), V(:,2),zeros(size(V,1),1));view(2);
text(V(:,1),V(:,2),zeros(size(V,1),1),num2str((1:size(V,1))'));
```