tags:

views:

120

answers:

3

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?

+2  A: 

You need to use the HOLD command so that the second plot is added to the first:

plot(softmax(:,1), softmax(:,2), 'b.');
hold on;
plot(softmaxretro(:,1), softmaxretro(:,2), 'r.');
gnovice
+7  A: 

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.')
Amro
A: 

You can also plot one on top of the other be slightly editing @amro's solution #2:

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

becomes

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

Adam Leadbetter

related questions