Legend for Classified image
4 views (last 30 days)
Show older comments
I have classified LISS 3 imagery using maximum likelihood method. I want to include legend for this classified output. Totally i classified 5 groups. how can i add legend for this output?
I have tried get(gca,'children') option but the legend was empty.
Kindly help me in this regard.
Warm regards Shoba
2 Comments
Massimo Zanetti
on 14 May 2021
This is the best answer, didn't know about the labeled colorbar.
Many thanks.
Answers (1)
Image Analyst
on 7 Sep 2013
Use text() to write out a text string in the color of the class in the image. For example, if class 1 is shown in red, then
text(column, row, 'Class 1 is red', 'Color', [1, 0, 0], 'FontSize', 24);
Of course you need to specify what row and column you want to place the upper left (or is it upper right) of your text string. Do similar code for the other classes/colors.
4 Comments
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!