フィルターのクリア

Is it possible to get color inside boxes?

2 ビュー (過去 30 日間)
prabhu singh
prabhu singh 2022 年 7 月 28 日
回答済み: Image Analyst 2022 年 7 月 28 日
x1=0;
x2=1;
y1=0;
y2=1;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
plot(x, y, 'b-', 'LineWidth', 3);
hold on;
x1=0.25;
x2=.75;
y1=0.25;
y2=.75;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
plot(x, y, 'b-');
xlim([-1, 2]);
ylim([-1, 2]);
Inner box i want to fill color with yellow
and outer box fill blue color but axes should not be there
2018a version

回答 (1 件)

Image Analyst
Image Analyst 2022 年 7 月 28 日
Try this:
% The inner box I want to fill with yellow color
% and outer box fill with blue color, but the axes should not be there.
x1=0;
x2=1;
y1=0;
y2=1;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
r1 = [x1, y1, x2-x1, y2-y1]
r1 = 1×4
0 0 1 1
x1=0.25;
x2=.75;
y1=0.25;
y2=.75;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
r2 = [x1, y1, x2-x1, y2-y1]
r2 = 1×4
0.2500 0.2500 0.5000 0.5000
% Plot them
rectangle('Position', r1, 'FaceColor', 'b')
hold on;
rectangle('Position', r2, 'FaceColor', 'y')
hold on
xlim([-1, 2]);
ylim([-1, 2]);
% Turn off the axes and tick marks
axis off;

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by