- https://www.mathworks.com/help/releases/R2023a/matlab/ref/axes.html
- https://www.mathworks.com/help/releases/R2023a/matlab/ref/set.html
- https://www.mathworks.com/help/releases/R2023a/matlab/ref/text.html
Figures in livescript resizing and overlapping with titles
9 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!