gpt4 book ai didi

matlab - 如何在 MATLAB 图形窗口的边缘周围创建边框?

转载 作者:太空宇宙 更新时间:2023-11-03 20:23:13 24 4
gpt4 key购买 nike

在将我的绘图保存为 .png 以突出显示一些最重要的绘图之前,我想在图形周围加上边框。有没有什么办法可以在轴绘图区域之外绘制一个矩形?

我希望边框围绕整个图延伸,甚至包括图标题和轴标签。

最佳答案

您可以通过将轴放在 uipanel 中来创建各种边框类型并调整 panel position , edge design , figure color , 和 panel colors .例如,这会创建一个带有从面板边缘延伸到图形边缘的内斜边的青色宽边框:

hFigure = figure('Color', 'c');  % Make a figure with a cyan background
hPanel = uipanel(hFigure, 'Units', 'normalized', ...
'Position', [0.1 0.1 0.8 0.8], ...
'BorderType', 'BeveledIn'); % Make a panel with beveled-in borders
hAxes = axes(hPanel, 'Color', 'none'); % Set the axes background color to none
title('Title Here');

enter image description here


这会创建一个 5 像素宽的红线边框,紧贴图形的边缘:

hFigure = figure();  % Make a figure
hPanel = uipanel(hFigure, 'Units', 'normalized', ...
'Position', [0 0 1 1], ...
'BorderType', 'line', ...
'BorderWidth', 5, ...
'BackgroundColor', 'w', ...
'HighlightColor', 'r'); % Make a white panel with red line borders
hAxes = axes(hPanel, 'Color', 'none'); % Set the axes background color to none
title('Title Here');

enter image description here

关于matlab - 如何在 MATLAB 图形窗口的边缘周围创建边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49678589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com