Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot 2 graphics in one picture?

Tags:

matlab

I have the following code to plot one graphic:

plot(softmax(:,1), softmax(:,2), 'b.')

and then this one to plot another:

plot(softmaxretro(:,1), softmaxretro(:,2), 'r.')

Now I'd like to be able to plot both ones in the same place. How can I accomplish that?

like image 822
devoured elysium Avatar asked Dec 29 '22 08:12

devoured elysium


1 Answers

Solution#1: Draw both set of points on the same axes

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

or you can use the hold command:

plot(softmax(:,1), softmax(:,2), 'b.')
hold on
plot(softmaxretro(:,1), softmaxretro(:,2), 'r.')
hold off

Solution#2: Draw each on seperate axes side-by-side on the same figure

subplot(121), plot(softmax(:,1), softmax(:,2), 'b.')
subplot(122), plot(softmaxretro(:,1), softmaxretro(:,2), 'r.')
like image 174
Amro Avatar answered Jan 13 '23 00:01

Amro