Figures in livescript resizing and overlapping with titles

조회 수: 8 (최근 30일)
Filip Fedorowicz
Filip Fedorowicz 2022년 8월 9일
답변: Saffan 2023년 9월 12일
Hi
I am using the following 3 fn's to export my figures in a livescript: exportgraphics(), savefig() and saveas(). My two histogram figures are fine however when I want to save and export the figure which is made up of a subplot figure (4x4 subplot with a title), my title is overlapping with the the first row of images in the subplot.
Is there a possibility to set the position of the subplot title so that it doesn't overlap with the actual plot?
Additionally, in the livescript output, the figures appear normal and after a few seconds the subplot is exploded and overlaps the figure.
Thanks in advance!

답변 (1개)

Saffan
Saffan 2023년 9월 12일
Hi Filip,
To prevent the subplot title from overlapping with the actual plot, you can use the “axes” method to create an axes object at the desired position and then add the title text using the “text” method. Here's an example code snippet:
% Create an axes object at the desired position for the title
axes('Position', [0, 0.95, 1, 0.05]);
% Customize the appearance of the axes
set(gca, 'Color', 'None', 'XColor', 'None', 'YColor', 'None');
% Add the title text to the axes
text(0.5, 0, 'My Title', 'FontSize', 14, 'FontWeight', 'Bold', ...
'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Bottom');
You can also use the axes method to set appropriate positions for the subplots within the figure.
You may refer the following documentation for more information:

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by