Matlab Query: how to align the "title" on the botton of a drawing when plotting points

My question says it all. I draw dots on Matlab. But when I set the value to "title", it by default displays the title of the title at the top of the image. How can I get the caption at the bottom of the image?

Thanks in advance.

+4
source share
2 answers

If you are not using xlabel , you can use this as a quick hack.

If you are using xlabel , add another line or two, passing in an array of cells:

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

As Amro noted in his comments, you can make text anywhere using 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') 

Positioning is not automatic, so when you resize a picture, the name will move away from the center.

+5
source

Another possibility is to move the X axis from above and bring the title to the bottom:

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

screenshot

+1
source

Source: https://habr.com/ru/post/1380867/


All Articles