Place a marker in different positions

4 ビュー (過去 30 日間)
isdapi
isdapi 2014 年 12 月 15 日
編集済み: Image Analyst 2014 年 12 月 15 日
This is part of my code:
a=abs(x_offset); %Value obtained previously.
x1_rec = -100*a;
y1_rec = tand(ANGLE)*(x1_rec - x_offset) + y_offset;
x2_rec = 100*a;
y2_rec = tand(ANGLE)*(x2_rec - x_offset) + y_offset;
line([x1_rec x2_rec],[y1_rec y2_rec],'Color',[.5 .6 .5],'LineStyle','--');
The question would be how can I set a marker in the defined line at two points of the line (for x_marker1=50*a and x_maker2=-50*a)?
So far I've only managed to place the markers at the two extremes of the line and I don't need that.
Also, I don't know if this is even possible but I'd want that the two markers of the line were of different type, one a triangle and the other a plus sign.
Any suggestion is welcome.

採用された回答

Image Analyst
Image Analyst 2014 年 12 月 15 日
編集済み: Image Analyst 2014 年 12 月 15 日
After line() call hold on and then plot
line(..................);
hold on;
% Plot triangle at (x_marker1, y_marker1).
plot(x_marker1, y_marker1, ...
'r^', 'MarkerSize', 20, 'LineWidth', 2);
% Plot + sign at at (x_marker2, y_marker2).
plot(x_marker2, y_marker2, ...
'r+', 'MarkerSize', 20, 'LineWidth', 2);
You can change the 'r*' to get different colors and markers, for example o=circle, d=diamond, .=dot, +=plus sign, s=square, etc..

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by