Skip to content

Instantly share code, notes, and snippets.

@paulgribble
Created November 19, 2015 14:49
Show Gist options
  • Save paulgribble/ecd11869d306a3ac870e to your computer and use it in GitHub Desktop.
Save paulgribble/ecd11869d306a3ac870e to your computer and use it in GitHub Desktop.
MATLAB "hold on" subplot demo for Gavin
x = 1:50;
figure
subplot(1,2,1)
hold on
plot(x, randn(size(x)),'bs-')
plot(x,sin(x),'r+-')
set(gca,'ylim',[-3 3])
plot(x,repmat(1,size(x,2)),'r-','linewidth',2)
plot(x,repmat(-1,size(x,2)),'r-','linewidth',2)
subplot(1,2,2)
hold on
plot(x, rand(size(x))*2 - 1,'bs-')
plot(x,cos(x),'r+-')
set(gca,'ylim',[-3 3])
plot(x,repmat(1,size(x,2)),'r-','linewidth',2)
plot(x,repmat(-1,size(x,2)),'r-','linewidth',2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment