How to draw a position vector on a 3D plot

조회 수: 23 (최근 30일)
Nagendra Kamath
Nagendra Kamath 2020년 9월 24일
답변: KSSV 2020년 9월 24일
Hi got to draw the 3D plot I needed but now I need to annotate it as shown below
I am finding answers only for 2D plots so can you please help me in drawing the arrow and annotating on it
if you need the txt file I've attached it also the code I used for the plot by the help of this community is
data = readmatrix('jamtp.txt'); x = data(:,1); y = data(:,2); z = data(:,3); f = scatteredInterpolant(x, y, z); xg = linspace(min(x), max(x), 20); yg = linspace(min(y), max(y), 20); [Xg, Yg] = meshgrid(xg, yg); Zg = f(Xg, Yg); surf(Xg, Yg, Zg);
I tried using plotttools to draw the arrow but it comes over the plot and I am not able to write over it
point at which I want the arrow annotation is (0,0,0) (1.57,1.57,125)
Plot is using 1:2:3 from the txt file attached

채택된 답변

KSSV
KSSV 2020년 9월 24일
  1. You can use the file exchange: https://in.mathworks.com/matlabcentral/fileexchange/278-arrow
  2. You can also use annotation
h=annotation('arrow');
set(h,'parent', gca, 'position', [50 5 20 2],'HeadLength', 1000, 'HeadWidth', 100, 'HeadStyle', 'hypocycloid', ...
'Color', [0.4 0.1 0.8], 'LineWidth', 3);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by