Figures in livescript resizing and overlapping with titles

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!

Antworten (1)

Saffan
Saffan am 12 Sep. 2023
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:

Produkte

Version

R2022a

Gefragt:

am 9 Aug. 2022

Beantwortet:

am 12 Sep. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by