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 09:17 In gplotmatrix.m, following is the code for putting legend on top right. % 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 I want to put this legend on top right but outside the plot. I have seen in help that there is a command "NorthEastOutside" for putting it out of the plot. But I dont know how to include this option in the code given above. Can anyone help me plz?
From: us on 27 Feb 2010 09:28 "Similione Kasan" <mech.engr(a)hotmail.com> wrote in message <hmb9h1$ji7$1(a)fred.mathworks.com>... > In gplotmatrix.m, following is the code for putting legend on top right. > > % 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 > > I want to put this legend on top right but outside the plot. I have seen in help that there is a command "NorthEastOutside" for putting it out of the plot. But I dont know how to include this option in the code given above. Can anyone help me plz? one of the solutions % create your plot lh=findall(gcf,'tag','legend'); set(lh,'location','northeastoutside'); % but: you'll see that it screws up the plot... us
From: Similione Kasan on 27 Feb 2010 09:49 "us " <us(a)neurol.unizh.ch> wrote in message <hmba5k$a8$1(a)fred.mathworks.com>... > "Similione Kasan" <mech.engr(a)hotmail.com> wrote in message <hmb9h1$ji7$1(a)fred.mathworks.com>... > > In gplotmatrix.m, following is the code for putting legend on top right. > > > > % 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 > > > > I want to put this legend on top right but outside the plot. I have seen in help that there is a command "NorthEastOutside" for putting it out of the plot. But I dont know how to include this option in the code given above. Can anyone help me plz? > > one of the solutions > > % create your plot > lh=findall(gcf,'tag','legend'); > set(lh,'location','northeastoutside'); > % but: you'll see that it screws up the plot... > > us 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.
From: us on 27 Feb 2010 10:30 "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
From: Similione Kasan on 27 Feb 2010 10:44 "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
|
Next
|
Last
Pages: 1 2 Prev: Loading a 3D image using DirectX file (.x file) Next: sending and receiving data in matlab using UDP object |