MATLAB: I want to create a plot using X Y coordinates

coordinatesplot

I have 51 nodes that each one of them has X Y coordinates. I used the command: plot(x,y, 'd') but I would like the figure to show me the number of each node next to the diamond.For example the first node I'd like to have the number 1 next to it, the second the number 2 etc. Also I'd like the first node to be different shape or colour from the others. Do I have to use two different types of plot or it can be done in the same command? Thank you for your time.

Best Answer

Use the text function.
Example: —
x = rand(1,5);
y = rand(1,5);
nrc = compose('%2d',1:numel(x)); % Coordinate Numbers (Cell Array)
cm = jet(numel(x)); % Use The ‘colormap’ Of Your Choice
figure
scatter(x, y, 75, cm, 'd', 'filled')
grid
text(x, y, nrc)
EDIT — (2 Jan 2021 at 19:18)
Changed from plot to scatter since it provides more options, especially with respect to colouring the points. There are a limited number of shapes, so I would just go with changing the colours. The sizes of the plotted points can chnage with the colours with scatter.