rectangle with color description

Hello,
I'm using a
rectangle
function to draw some color specification on my plots. I'd like to specify what is the meaning of each color. For example lets say there is only
a=1:10;
plot(a)
on the figure and 3 background colors drawn with the rectangle function
rectangle('Position' [1,1,2,10], 'FaceColor', 'r')
rectangle('Position' [4,1,2,10], 'FaceColor', 'g')
rectangle('Position' [7,1,2,10], 'FaceColor', 'k')
I'd like to mention what is the meaning of r g and k. How can I do that?

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 3 月 5 日

0 投票

If you record the handles of the rectangle calls then you can legend() those specifically

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2018 年 3 月 5 日

回答済み:

2018 年 3 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by