SUBPLOT 関数で表示した軸にグラフを重ね描きする方法はありますか?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
下記のようにグラフを重ねて描画したいのですが、上書きされてしまい意図した結果になりません。重ね描きする方法を教えてください。
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
Réponse acceptée
MathWorks Support Team
le 14 Déc 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!