如何增加图形的大小而不划分我的情节?
62 views (last 30 days)
节目older comments
Hi,
I'm plotting a 3d mesh along with a colorbar on the side. Unfortunately the default figure size is cropping my colormap labels. I've tried changing my figure's position attribute, but then it changes my plot aspect ratio.
如何增加图形的大小而不划分我的情节?
Thanks,
Vinícius。
Accepted Answer
Dave B
2021年8月22日
A few different solutions (demos below):
- 如果您不希望变化的数字位置改变纵横比,请设置纵横比。轴上有两个控件:plotboxAspectratio和dataAspectratio。他们的互动方式可能会令人困惑,因此最好尝试获得所需的结果。详细信息://www.tianjin-qmedu.com/help/matlab/creating_plots/manipulating-axes-aspect-ratio.html
- 设置轴的位置,而不是图形,ithink这就是您所追求的?
- 当轴处于TileChartLayout中时,我们在定位配色栏方面做得更好。因此,听起来很奇怪,布局中的单个轴可能会更好地为配色栏提供适当的空间。我们正在尝试通过每个发行版来改进这一点,但是如果您正在使用2021A,如问题所述,应该非常好。但是,这将调整纵横比,因此请参见上文,以了解如何限制它。
% 原来的:
f =图;
ax =轴;
冲浪(峰);
配色栏('ticklabels',“很长的tick标签”);
title('原来的');
纵横比的%限制,数字位置调整了
f =图;
ax =轴;
冲浪(峰);
配色栏('ticklabels',“很长的tick标签”);
F.位置(3)= 1000;
ax.PlotBoxAspectRatio=[1 1 1];
title(“调整了数字位置,没有好多了”)
调整了%轴位置以使空间
f =图;
ax =轴;
冲浪(峰);
配色栏('ticklabels',“很长的tick标签”);
ax.OuterPosition(3:4)=.75;
title(“调整轴位置”)
% TiledChartLayout approach
f =图;
ax=nexttile;
冲浪(峰);
配色栏('ticklabels',“很长的tick标签”);
title('TiledChartLayout: may cramp your axes')
% TiledChartLayout with constrained aspect ratio
f =图;
ax=nexttile;
冲浪(峰);
ax.dataAspectratio = [1 1 .5];
配色栏('ticklabels',“很长的tick标签”);
title('TiledChartLayout + DataAspectRatio')