output matlab markers as part of a character string.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Leo Simon
am 26 Jul. 2015
Kommentiert: Leo Simon
am 29 Jul. 2015
It's amazing that nobody has asked this before, but I'd like to insert the standard matlab plot markers---square, diamond, circle, etc---into a character string. Presumably this is possible?
For reasons too banal to explain, it's not easy for me to use the standard legend commands, and the quickest quick-dirty fix is to create my own, as annotations.
Thanks for any suggestions how to do this.
PS, I'm getting closer to doing this with unicode characters. Could anybody please tell me the matlab unicode character for an unfilled diamond? I've found circle (9711) and square (9744).
Thanks very much!
2 Kommentare
Akzeptierte Antwort
Cindy Solomon
am 28 Jul. 2015
Hi Leo,
To add to Walter's comment, (if I understand what you are trying to do correctly), I would also recommend looking into the native2unicode function or the reverse (unicode2native). These combined with the char function can let you insert a variety of characters in as plot markers. For example:
%*** Create A Plot With NO Markers ***
x = 1:40;
y = rand( 1, 40 );
plot( x, y );
axis( [0.5, 40.5, -0.1, 1.1 ] );
%*** Add Filled Markers from 1 to 10 (u+2776 to u+277F) ***
for i = 1:10
nativeValue = char( hex2dec( '2776' ) + i - 1); %Native format (bit/byte arrangement)
unicodeValue = native2unicode( nativeValue, 'UTF-16' ); %Convert to Unicode 16 format
text( x( i + 20 ), y ( i + 20 ),... %Position of font character
unicodeValue,...
'FontSize',12,... %Set font size to 12
'HorizontalAlignment', 'Center',... %Center character on point
'VerticalAlignment', 'Middle' );
end
I apologize if I misunderstood your question, but hope this is helpful!
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!