MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在一张图片中绘制2个图形? (https://www.labfans.com/bbs/showthread.php?t=22968)

poster 2019-12-10 16:49

如何在一张图片中绘制2个图形?
 
我有以下代码来绘制一张图形:

plot(softmax(:,1), softmax(:,2), 'b.') 然后再画一个:

plot(softmaxretro(:,1), softmaxretro(:,2), 'r.') 现在,我希望能够将两者同时绘制在同一位置。我该怎么做?


回答:
[B]解决方案1:在同一轴上绘制两组点[/B]

plot(softmax(:,1),softmax(:,2),'b.', softmaxretro(:,1),softmaxretro(:,2),'r.') 或者您可以使用hold命令:

plot(softmax(:,1), softmax(:,2), 'b.') hold on plot(softmaxretro(:,1), softmaxretro(:,2), 'r.') hold off [B]解决方案2:在同一张图上并排绘制各个轴[/B]

subplot(121), plot(softmax(:,1), softmax(:,2), 'b.') subplot(122), plot(softmaxretro(:,1), softmaxretro(:,2), 'r.')

[url=https://stackoverflow.com/questions/1858039]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 02:23

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.