3

私が使用しsubplotているのは、3 つの異なるプロットを含むものです。各プロットには、独自のラベルとタイトルがあります。
問題は、プロットを保存するときにプロットを最大化する必要があることです。そうしないと、テキストが互いに重なります。
最大化すると、ESP 形式または任意のベクトル形式を使用しても、サブプロットのラベル テキストが画像内で少しぼやけて表示されます。
この問題を解決するにはどうすればよいですか?

4

5 に答える 5

5

タイトルの重複の問題については、文字列のセル配列を title() の入力パラメーターとして使用して、複数行のタイトル テキストを生成できます。

title_text = {'first line', 'second line', 'third line'};
title(title_text);

また、ラベル テキストでも機能します。

于 2013-05-23T20:31:12.563 に答える
2

Da Kuangの回答に加えて、タイトルとラベルを同じ行に保ちたい場合は、フォントサイズを変更できます

a = axes;
t = title('My Really Long Title');
l = xlabel('My Really Long x label')
set(t, 'FontSize', 8)
set(l, 'FontSize', 8)
于 2013-05-23T20:38:56.457 に答える
2

ラベルがぼやけている理由はわかりませんが、オーバーラップについてはお手伝いできます。

subplot画像を保存したい場合(紙など)には使用しません。私が代わりに行っているのは、各軸を個別に作成することです。これにより、各軸をより詳細に制御できます。

以下はかなり一般的な例で、サブプロットよりもはるかに細かく配置を制御して軸の任意のグリッドを生成する方法を示しています。もちろん、軸が 3 つしかないので、実際にループは必要ありませんが、ニーズに合わせてこれを調整できると確信しています。

% first create the figure
figPos = [200 200 800 500];
figure('Color', 'w', 'Position', figPos)

% next, determine how much padding you want on each side of the axes, and in
% between axes. I usually play around with these, and the figure size until
% the layout looks correct.

leftPadding = 50/figPos(3); % the space at the left of the figure
rightPadding = 25/figPos(3); % the space at the right of the figure
horizPadding = 80/figPos(3); % the space between axes (horizontally)
topPadding = 30/figPos(4); % the space at the top of the figure
bottomPadding = 50/figPos(4); % the space at the bottom of the figure
vertPadding = 120/figPos(4); % the space between axes (vertically)

% set up the grid size
nHorizAxes = 2;
nVertAxes = 3;

% figure out how big each axes should be
horizPlotSpace = 1-leftPadding-rightPadding-(nHorizAxes-1)*horizPadding;
vertPlotSpace = 1-topPadding-bottomPadding-(nVertAxes-1)*vertPadding;
width = horizPlotSpace/nHorizAxes;
height = vertPlotSpace/nVertAxes;

myAxes = zeros(nVertAxes, nHorizAxes);

% create some sample data to plot for illustrative purposes
x = linspace(0, 2*pi);
y = sin(x);

for iRow = 1:nVertAxes
    for iCol = 1:nHorizAxes
        % calculate the position
        left = leftPadding+(iCol-1)*(width+horizPadding);
        bottom = bottomPadding+(iRow-1)*(height+vertPadding);
        position = [left bottom width height];

        myAxes(iRow, iCol) = axes('Position', position);
        plot(x, y)
        xlabel('Test Label')
        ylabel('Test Label')
        title(sprintf('axes(%d, %d)', iRow, iCol))
    end
end
于 2013-05-23T21:30:58.197 に答える
0

これらの回答は役立つはずですが、テキストが重なる原因に応じて、他にも試してみるべきことがいくつかあります。

図のサイズを変更して、テキスト用のスペースを確保します。例えば:

set(gcf, 'PaperSize', [5 7])

サブプロットのサイズを変更します。

s = get(gca, 'Position');
set(gca, 'Position', [s(1), s(2), s(3), s(4) * 0.5])
于 2013-05-23T21:09:21.453 に答える