How I can change the arrow head and style in a compass plot?

조회 수: 21 (최근 30일)
loriotto
loriotto 2021년 7월 15일
편집: dpb 2021년 7월 16일
I have a compass plot with about 60 arrows of different angles and lengths. Now, I would like to change the arrows to just straight lines without arrow heads in a compass plot. How can I do that?
thank you for any help!

채택된 답변

dpb
dpb 2021년 7월 15일
편집: dpb 2021년 7월 16일
That's not easy -- the arrowheads are part of the lines so they're not separate objects that can be changed independently of the line.
But, it's not hard to draw using polar -- using the example data from the doc for compass
% sample data
u = [5 3 -4 -3 5];
v = [1 5 3 -2 -6];
% the engine
[th,r]=cart2pol(u,v); % convert to polar coordinates
th=[zeros(size(th));th]; % augment with origin points
r=[zeros(size(r));r];
hP=polar(th,r); % plot on polar axis
produces
ADDENDUM
Actually, on reflection, it's not so hard after all -- the arrow line data points are the last three of each set for each line so
hC=compass(u,v); % return line handles
for i=1:numel(hC)
hC(i).XData(end-2:end)=nan; % HG won't display NaN points (arrows)
end
Trick is to let the builtin feature of handle graphics to not display points if are ~finite() instead of thinking of trying to change a property of the line--change the data instead.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by