|
i get the following error
??? Error using ==> legend>process_inputs at 569
Invalid argument. Type 'help legend' for more information.
Error in ==> legend>make_legend at 330
[orient,location,position,children,listen,strings,propargs] = process_inputs(ha,argin);
Error in ==> legend at 288
[h,msg] = make_legend(ha,varargin(arg:end));
Error in ==> refractive_index_estimation at 143
legend(p,'Location','Best');
"Rafael Herrejon" <rafael.erasethis@ic.is.tohoku.ac.jp> wrote in message <gr4p5p$hu8$1@fred.mathworks.com>...
> > Hello,
> >
> > I want to add a legend to my plot, i am plotting using the following code but when i do it this way it plots the point on different plots and the legend does not show all three entries together just one entry at a time... when i comment out the legend line it plots fine all three plots on one plot!
> >
> > if (f_flag==1)
> > p=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-+m');
> > hold on;
> > % legend('plain');
> > else if (f_flag==2)
> > o=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-or');
> > hold on;
> > % legend('oil');
> > else if (f_flag==3)
> > v=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-*c');
> > hold on;
> > % legend('vaseline');
> > end
> >
> > can anyone help me with this?
> >
> > Bye
> > end
> > end
>
> Try this
>
> figure
> hold on;
> if (f_flag==1)
> count=count+1;
> p(count)=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-+m');
> set(p(count),'DisplayName','plain');
> else if (f_flag==2)
> count=count+1;
> p(count)=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-or');
> set(p(count),'DisplayName','oil');
> else if (f_flag==3)
> count=count+1;
> p(count)=plot(polang(file_name),intensity(x,y,file_name,f_flag),'-*c');
> set(p(count),'DisplayName','vaseline');
> end
> end
> end
> hold off
> legend(p,'Location','Best')
|