## Is there a way to plot the name of a point on a figure when it is plotted?

### Brian (view profile)

on 6 May 2013

Hello,

I need to change this code so that I can plot some of the node names next to the plotted nodes on the figure when it is plotted. (the plot would be of finite elements). Is there a way to do this? Thanks for your time

``` function PolyMshr_PlotMsh(Node,Element,NElem,Supp,Load) % In order to use the Matlab patch function to plot the entire mesh at once, we create an element connectivity matrix ElemMat that is padded with NaNs
clf; axis equal; axis off; hold on;
Element = Element(1:NElem)';                 %Only plot the first block
MaxNVer = max(cellfun(@numel,Element));      %Max. num. of vertices in mesh %
ElemMat = vertcat(ElemMat{:});               %Create padded element matrix
patch('Faces',ElemMat,'Vertices',Node,'FaceColor','w'); pause(1e-6)
plot(Node(Supp(:,1),1),Node(Supp(:,1),2),'b>','MarkerSize',8);
end```

## Products

### per isakson (view profile)

on 6 May 2013

The function

`    text( x, y, string )`

will do that.

per isakson

### per isakson (view profile)

on 7 May 2013

To me "some of the node names" is a string. What do you mean?

Brian

### Brian (view profile)

on 7 May 2013

Sorry. I meant that there is an array (called fem.e ) which corresponds to these coordinates on the figure. Would I be able to print the numbers of the elements next to the element on the figure. thanks again

per isakson

### per isakson (view profile)

on 7 May 2013

Yes,

`    text( x, y, sprintf( '#%i', the_number_of_the_element ) )`

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi