Adding legend in Matlab to the layout

Hi everyone, I want to add the following legend to this layout but don't know how to do it.
Square shape is for Building Triangle shape for HBSs Stars shape for ABSs.
Any help will be really appreciated, thank you so much.

2 Comments

Gotta' run, but
doc text
should get you started, I'd think...
Hi, How can i draw a triangle, square and star using text function ?

Sign in to comment.

 Accepted Answer

Enlarging on dpb’s comment, consider a textbox. See Annotation Textbox Properties for details.

7 Comments

Hi, Done with the star and and delta, but what is TeX command for a square ? Can't find it there.
Hi this is where i am stuck in the legend section. 1. Can't draw the square shape for the building. 2. Also the corresponding colours for each element for the legend as at the moment all of them are black.
Here is my code for the textbox section.......................
annotation('textbox',... [0.75 0.65 0.05 0.1],... 'String',{'Legend \Delta-HBS \ast-ABS -Building'},... 'FontSize',12,... 'FontName','Arial',... 'LineStyle','-',... 'EdgeColor',[0 0 0],... 'LineWidth',2,... 'BackgroundColor',[1 1 1],... 'Color',[0 0 0]);
Had to look for that, since TeX seems to have overlooked it. Apologise for the delay.
The best option I can think of for the open square is the Webdings character 99 ( 63 hex ). (I believe it displays as the lower-case ‘c’ in ASCII.) In text, you can specify FontName and FontSize, so that might be your best option. (Webdings is a standard Windows-supplied font.)
This illustrates the Webdings version, whimsically:
figure(1)
plot([-0.3:0.1:0.3], 0.3+[-0.3:0.1:0.3].^2)
text(-0.3, 0.7, 'c', 'FontName', 'Webdings', 'Color', 'b')
text(0.3, 0.7, 'c', 'FontName', 'Webdings', 'Color', 'b')
text(0.0, 0.5, '\Delta', 'Color', 'r')
axis([-1 1 0 1])
The only other option I can think of for the open square is the Unicode symbol for it: □. The problem is that I don’t know if it will display correctly in MATLAB. I’ve had problems displaying Unicode characters in MATLAB, which usually displays them as: ??.
EDIT — Added '\Delta' and 'Color'.
Done, Thank you once again. Cheers bro........
As always, my pleasure!
Hi, Just to show you, this is what i made as final version of my layout. Take care.
Cool!
I’m sure your audience will be appropriately impressed, and appreciative of your efforts!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!