MATLAB Answers

# Print point numbers with velocities

2 views (last 30 days)
giometar on 15 Jan 2018
Answered: giometar on 15 Jan 2018
Hello I have data like this: PN x y vx vy R397 6358409 4976666 -0.35822 0.13043 R356 6358725 4981623 -0.31862 0.02681 R372 6362466 4971996 -0.17017 0.11630 How to plot point velocities with point numbers? Thanks for help.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (3)

ANKUR KUMAR on 15 Jan 2018
I haven't get the your question completely. Upto my understanding, you are trying to plot something with respect to something.
A1=(1:5)
A2=randi(25,1,5)
plot(A1,A2)
If you want to put xtick lables by your own, then you can do,
xticks([1:5])
xticklables({'First','Second','Third','Fourth','Fifth'})
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

giometar on 15 Jan 2018
Thanks, but this is not what I am looking for. I have points with x and y coordinates, and their velocities. I want to plot velocities and point numbers. When I use command quiver(x,y,vx,vy) it plots velocities without point numbers.
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

giometar on 15 Jan 2018
If someone else need it, here is answer for my question:
% Plot 2D point velocities and point numbers
% input 2D coordinates like matrix nx2 (in this case matrix p)
p = rand(10,2);
% Create labels for all points - point numbers
labels = cellstr( num2str([1:10]'));
% Plot point numbers
plot(p(:,1), p(:,2), 'rx')
text(p(:,1), p(:,2),labels, 'VerticalAlignment','bottom',...
'HorizontalAlignment','right')
hold on
% Plot velocities
quiver(x,y,vx,vy)
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!