When i use plotyy to plot two functions in the same plot, it is only the
first plotted function that gets a colorized legend. How do i get both
legends colorized? (the text of both of them are displayed, but i miss the
color index)
another question: With only one plot i can use ylabel('mylabel') to give a
lable on the y-axis. How do i use this with two y-axis?
sincerely,
Brian
% Best regards;Brian Lodahl ; lod...@kom.auc.dk
% http://www.kom.auc.dk/~lodahl ; RISC group 850;Room A6-118;
% RF Integrated Systems & Circuits (RISC);Aalborg University;
% Frederik Bajers Vej 7;DK-9220 Aalborg Ø;Denmark
clc;s=zeros(1,52);c=[+'a':+'z',' '];f=5;a=clock;a=fix(f*a(6));
while(1)while(1)b=clock;b=fix(f*b(6));if(b~=a)break,end,end,a=b;
str=('my name is brian and i am just another matlab hacker');
k=find(s~=str);n=length(k);if~n,break,end;x=c(ceil(27*rand(1,n)));
s(k)=x;fprintf('\r%s',s);end;fprintf('\n');clear%;clc;str
Hi,
Note that plotyy create two axes objects on on top of the other. You can control the properties of each. First find the axes objects (before making a legend):
>>H=findobj(gcf,'type','axes');
» axes(H(2)),ylabel('Income')
» axes(H(1)),ylabel('Value')
The legend command can be applyed only to one of the axes. This is because it is a third axes object that takes values from the current axes and the objects drawn on it.
Joe
BSTEX - Equation viewer for Matlab
<http://www.geocities.com/bstex2001>
After having to ask an older student (there goes my pride :) i found out
how to do it. The legend also works here.
But still; thanks for the advice.
sincerely,
Brian
----[snip]----
figure(1)
subplot(211),
[ax,h1,h2]=plotyy(P_in,20*log10(abs(S_11)),P_in,VSWR);
grid
xlabel('P_{in} [dBm]')
set(get(ax(1),'Ylabel'),'String','|S_{11}|')
set(get(ax(2),'Ylabel'),'String','VSWR')
set(h1,'linestyle','-')
set(h2,'linestyle','--')
legend([h1,h2],'S_{11}','VSWR',0)
---[snap]---