Is it possible to get color inside boxes?
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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]
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]
% 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;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!