Reputation: 8466
I want to plot both stimulus curve and response curve in a single figure and signle axes although their scale and unit are different. The following is what I want to get:
My supervisor has made this figure by an expensive software package called SigmaPlot. The stimulus is in red and the response is in black.
My question is how to make such a plot in MATLAB?
I am aware of a function called plotyy, but it is not helpful.
EDIT:plotyy is not helpful because it puts another axes in the right side and it is just unnecessary to add that extra axes.(there might be a way to remove the right axes, do you now how to do that?).
Upvotes: 1
Views: 397
Reputation: 12693
In addition to plotting both on the same axes, here's an option making use of plotyy
and axes properties:
t=0:pi/64:2*pi;
figure;
handles = plotyy(t,cos(t),t,ones(size(t)).*t>pi);
set(handles(1),'ylim',[-1.5 1.5],'box','off')
set(handles(2),'ylim',[-18 2],'visible','off')
This way you can leave whatever scaling/y offset you have in one plot and not worry about the other one rescaling and messing up your second one.
Upvotes: 4