Export Graph With Full Size

1 回表示 (過去 30 日間)
Moh Rifqy Risqullah
Moh Rifqy Risqullah 2023 年 6 月 29 日
回答済み: Khushi Yadav 2023 年 6 月 30 日
Hello. i want to export my graph using
f = gcf;
exportgraphics(f,'VC_Effect.png','ContentType','image');
and the result is like this
the title and label are interfere. How can i set my code to obtain graph like this
*) this is just a screenshoot
I change the resolution in exportgraph's input argument but it doesn't effect.

回答 (1 件)

Khushi Yadav
Khushi Yadav 2023 年 6 月 30 日
I understand that you want to change the alignment of the labels to horizontal and position the title in the centre of the graph. To make the labels horizontal, you can use the xtickangle function. For aligning the title in the centre horizontally, you can refer the following code:
f = gcf;
% get the current axes handle
ax=gca;
% change the label alignment to horizontal
xtickangle(ax,0);
% set the title and align it in the center
title(ax,'Your Title', 'HorizontalAlignment', 'center');
exportgraphics(f, 'VC_Effect.png', 'ContentType', 'image');
Please refer to the documentation for more information:
  1. xtickangle function:Rotate x-axis tick labels - MATLAB xtickangle - MathWorks India
  2. Add title: Add title - MATLAB title - MathWorks India
Hope this addresses your question!

カテゴリ

Help Center および File ExchangeGraphics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by