MATLAB Answers

Marker Symbol 'I' in plot

15 views (last 30 days)
I would like to use '|' the vertical line as a marker symbol. It is also listed as a marker symbol here: 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?


Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 6 Nov 2020
You can use a text object as a work-around:
x = 1:50;
y = rand(size(x));
plot(x, y, '.', 'Color','none')
axis([0 50 0 1])
text(x, y, '|', 'VerticalAlignment','middle', 'HorizontalAlignment','center', 'Color','r')
If you want to use the horizontal line with this approach, use (char(151)) not underscore _.


Arijana Bohr
Arijana Bohr on 6 Nov 2020
Thank you!
Star Strider
Star Strider on 6 Nov 2020
As always, my pleasure!

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!

Translated by