Prev: Loading a 3D image using DirectX file (.x file)
Next: sending and receiving data in matlab using UDP object
From: Similione Kasan on 27 Feb 2010 10:50 "Similione Kasan" <mech.engr(a)hotmail.com> wrote in message <hmbek4$avd$1(a)fred.mathworks.com>... > "us " <us(a)neurol.unizh.ch> wrote in message <hmbdqf$ko3$1(a)fred.mathworks.com>... > > "Similione Kasan" > > > > > Thanks for the reply but I remember one of the guys introduce a new variable say "h" in the same code I mentioned above and for that variable h he made the legend to appear outside the plot......that did not scew the plot but the changings he made are on his computer..... > > > > > > Could you think how would he have done that. > > > > well, yes... > > > > ph=plot(rand(10,1),'-ks'); > > ah=axes('position',[.1,.1,.5,.5],'visible','off'); > > lh=legend('v6',ah,ph,'foo','location','northeastoutside'); > > % but: you'll see the runtime warning (r2009b)... > > > > % it would probably be easier to set the LEGEND's position prop > > % your plot... > > lh=findall(gcf,'tag','legend'); > > lp=get(lh,'position'); > > set(lh,'position',[.1,.1,lp(3:4)]); > > > > us > > ----I have tried this but still I have to set the position which takes sometime. I dont say that it is wrong but I am sure my friend just changed one little thing in the following code and automatically legend started to appear outside the graph on top right position and the symmetry of graph was not disturbed....He did not add anything special instead introduced "NorthEastOutside" somewhere in the code given below: > > % Create legend if requested; base it on the top right plot > if (doleg) > gn = gn(ismember(1:size(gn,1),g),:); > legend(ax(1,cols),gn); > end --------------------- Hey I have found the way to put it outside...see the changes I made to the code: % Create legend if requested; base it on the top right plot if (doleg) gn = gn(ismember(1:size(gn,1),g),:); h=legend(ax(1,cols),gn); set(h,'Location','NorthEastOutside'); end I simply set h as the legend and wrote it to be outside the plot..... But anyways thanksalot for taking interest in my post :)) Keep up the good work "us"....
From: us on 27 Feb 2010 11:07 "Similione Kasan" > % Create legend if requested; base it on the top right plot > if (doleg) > gn = gn(ismember(1:size(gn,1),g),:); > h=legend(ax(1,cols),gn); > set(h,'Location','NorthEastOutside'); > end > > I simply set h as the legend and wrote it to be outside the plot..... > But anyways thanksalot for taking interest in my post :)) Keep up the good work "us".... well... this mimics EXACTLY what i told you in my first reply(?)... lh=findall(gcf,'tag','legend'); % <- instead of returning the handle H... set(lh,'location','northeastoutside'); % now, since you seem to be happy with the solution(?) - and have actually % changed the function(!), why not simply add legend(ax(1,cols),gn,'location','northeastoutside'); us
From: Similione Kasan on 27 Feb 2010 12:36 "us " <us(a)neurol.unizh.ch> wrote in message <hmbfv7$69n$1(a)fred.mathworks.com>... > "Similione Kasan" > > > % Create legend if requested; base it on the top right plot > > if (doleg) > > gn = gn(ismember(1:size(gn,1),g),:); > > h=legend(ax(1,cols),gn); > > set(h,'Location','NorthEastOutside'); > > end > > > > I simply set h as the legend and wrote it to be outside the plot..... > > But anyways thanksalot for taking interest in my post :)) Keep up the good work "us".... > > well... this mimics EXACTLY what i told you in my first reply(?)... > > lh=findall(gcf,'tag','legend'); % <- instead of returning the handle H... > set(lh,'location','northeastoutside'); > > % now, since you seem to be happy with the solution(?) - and have actually > % changed the function(!), why not simply add > > legend(ax(1,cols),gn,'location','northeastoutside'); > > us ---------- oh yes you are correct...I just realized that...thanks for ur time
First
|
Prev
|
Pages: 1 2 Prev: Loading a 3D image using DirectX file (.x file) Next: sending and receiving data in matlab using UDP object |