8

複数の x 軸が上下にあり、y 軸が 1 つだけの matlab プロットを作成しようとしています。

Mathworks ファイル交換を調べたところ、複数の y 軸に対する提案/スクリプトしかありません。R に対してこの質問のようなことを達成したいと思います。

4

3 に答える 3

4

異なるスケールを表示するために2番目の軸のみが必要な場合の解決策の例を次に示します(Jeff_Kの解決策ですが、よりうまくいきました):

first_axis = gca;
sqz = 0.12; %// distance to squeeze the first plot
set(first_axis, 'Position', get(first_axis, 'Position') + [0 sqz 0 -sqz ]);
ax2 = axes('Position', get(first_axis, 'Position') .* [1 1 1 0.001] - [0 sqz 0 0],'Color','none');
scale_factor = 42; %// change this to your satisfaction
xlim(get(first_axis, 'XLim') * scale_factor);
set(ax2, 'XScale', get(first_axis, 'XScale')); %// make logarithmic if first axis is too
于 2014-09-05T15:25:57.493 に答える
-1

これにはパッチ関数を使用する必要があります。詳細については、こちらをご覧ください: http://www.mathworks.com/matlabcentral/fileexchange/26550-myplotyy

于 2012-08-11T04:27:33.443 に答える