Print point numbers with velocities

5 次查看(过去 30 天)
giometar
giometar 2018-1-15
回答: giometar 2018-1-15
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.

回答(3 个)

ANKUR KUMAR
ANKUR KUMAR 2018-1-15
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'})

giometar
giometar 2018-1-15
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.

giometar
giometar 2018-1-15
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)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by