SUBPLOT 関数で表示した軸にグラフを重ね描きする方法はありますか?
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
下記のようにグラフを重ねて描画したいのですが、上書きされてしまい意図した結果になりません。重ね描きする方法を教えてください。
ax1 = subplot(2,1,1);
plot(ax1,rand(1,10))
ax2 = subplot(2,1,2);
plot(ax2,rand(1,10),'r')
hold on
plot(ax1,rand(1,10),'g')
hold off
Akzeptierte Antwort
MathWorks Support Team
am 14 Dez. 2009
デフォルトの設定では、SUBPLOT関数は重ね描きする際に、一度軸をクリアしその上から新しいグラフをプロットします。そこで、軸の'NextPlot'プロパティを'add'に設定することで、重ね描きを実現することができます。
ax1 = subplot(2,1,1);
plot(ax1,rand(1,10))
ax2 = subplot(2,1,2);
plot(ax2,rand(1,10),'r')
hold on
set(ax1,'NextPlot','add');
plot(ax1,rand(1,10),'g')
hold off
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!