繁体   English   中英

Matlab查询:绘制点时如何在图的底部对齐“标题”

[英]Matlab Query: How to align 'title' at the botton of the figure when plotting points

我的问题说了一切。 我在Matlab上绘制点。 但是当我设置'title'值时,默认情况下它会在图像顶部显示title-name。 如何将标题集设置为图像的底部?

提前致谢。

如果你不使用xlabel你可以使用它作为快速黑客。

如果您使用xlabel ,请通过传递单元格数组添加另一行或两行:

figure;
xlabel({'X-label', '', 'Figure title'});

正如Amro在他的评论中提到的,你可以使用uicontrol在任何地方制作文本:

x=linspace(0,10*pi);
plot3(x,x.*cos(x),x.*sin(x)); % Plot a 3d spiral
uicontrol('Style','text','Position', [200 20 200 20],'String','My Title')

定位不是自动的,因此当您调整图形大小时,标题将远离中心。

另一种可能性是将x轴移到顶部,并将标题置于底部:

plot(rand(10,1))
h = xlabel('');     pos = get(h,'Position'); delete(h)
h = title('title'); set(h,'Position',pos);
set(gca, 'XAxisLocation','top')

截图

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM