Marker Symbol 'I' in plot

조회 수: 23 (최근 30일)
Arijana Bohr
Arijana Bohr 2020년 11월 6일
댓글: Star Strider 2020년 11월 6일
I would like to use '|' the vertical line as a marker symbol. It is also listed as a marker symbol here: https://www.mathworks.com/help/matlab/creating_plots/create-line-plot-with-markers.html However when I tried to use it, I got this error message:
Error setting property 'Marker' of class 'Line':
'|' is not a valid value. Use one of these values: '+' | 'o' | '*' | '.' | 'x' | 'square' | 'diamond' | 'v' | '^' | '>' | '<' | 'pentagram' | 'hexagram'
| 'none'.
Is it possibe to use '|' as a marker symbol and if yes, how do I do that?

채택된 답변

Star Strider
Star Strider 2020년 11월 6일
You can use a text object as a work-around:
x = 1:50;
y = rand(size(x));
figure
plot(x, y, '.', 'Color','none')
axis([0 50 0 1])
text(x, y, '|', 'VerticalAlignment','middle', 'HorizontalAlignment','center', 'Color','r')
producing:
If you want to use the horizontal line with this approach, use (char(151)) not underscore _.
.
  댓글 수: 2
Arijana Bohr
Arijana Bohr 2020년 11월 6일
Thank you!
Star Strider
Star Strider 2020년 11월 6일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2020년 11월 6일
편집: Walter Roberson 2020년 11월 6일

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by