Prev: openGL bug
Next: Sptool Spectral analysis
From: Anbazhagan on 12 Apr 2010 09:26 I am plotting two boxplots in one figure using hold on in matlab 7.1. Legend of the first boxplot gets lost when second one is plotted. How can i hold the legend as well? I
From: Walter Roberson on 12 Apr 2010 14:27 Anbazhagan wrote: > I am plotting two boxplots in one figure using hold on in matlab 7.1. > Legend of the first boxplot gets lost when second one is plotted. How > can i hold the legend as well? I Is it possible that the older legend is present but hidden underneath the newer one? Did you specifically use different positions in the legend() function ?
From: Anbazhagan on 13 Apr 2010 01:11 Walter Roberson <roberson(a)hushmail.com> wrote in message <hpvonf$11g$2(a)canopus.cc.umanitoba.ca>... > Anbazhagan wrote: > > I am plotting two boxplots in one figure using hold on in matlab 7.1. > > Legend of the first boxplot gets lost when second one is plotted. How > > can i hold the legend as well? I > > Is it possible that the older legend is present but hidden underneath the > newer one? Did you specifically use different positions in the legend() function ? yes. it is hidden underneath. Am using the 'best' position for both legends.
From: Walter Roberson on 13 Apr 2010 10:38 Anbazhagan wrote: > Walter Roberson <roberson(a)hushmail.com> wrote in message > <hpvonf$11g$2(a)canopus.cc.umanitoba.ca>... >> Anbazhagan wrote: >> > I am plotting two boxplots in one figure using hold on in matlab >> 7.1. > Legend of the first boxplot gets lost when second one is >> plotted. How > can i hold the legend as well? I >> >> Is it possible that the older legend is present but hidden underneath >> the newer one? Did you specifically use different positions in the >> legend() function ? > > yes. it is hidden underneath. Am using the 'best' position for both > legends. Well, change your code so that you use different specific corners. legend() does not look at the graphics drawn already in order to find the best place: it only looks at the data values of the axis it is associated with.
From: Anbazhagan on 13 Apr 2010 11:03
Walter Roberson <roberson(a)hushmail.com> wrote in message <hq1vlt$ihc$2(a)canopus.cc.umanitoba.ca>... > Anbazhagan wrote: > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > <hpvonf$11g$2(a)canopus.cc.umanitoba.ca>... > >> Anbazhagan wrote: > >> > I am plotting two boxplots in one figure using hold on in matlab > >> 7.1. > Legend of the first boxplot gets lost when second one is > >> plotted. How > can i hold the legend as well? I > >> > >> Is it possible that the older legend is present but hidden underneath > >> the newer one? Did you specifically use different positions in the > >> legend() function ? > > > > yes. it is hidden underneath. Am using the 'best' position for both > > legends. > > Well, change your code so that you use different specific corners. > legend() does not look at the graphics drawn already in order to find > the best place: it only looks at the data values of the axis it is > associated with. I tried your suggestion but the first legend flashes for a second and then disappears. Then it displays only one legend but it is wrong i.e; it displays second boxplot legend text with the first boxplot line color. I tried this approach but I receive an error M={'Test A',Test B'}; p1=boxplot(bxplt_data2,'orientation','horizontal','label',bxplt_lbl,'colors','b','symbol','b+'); hold on p2=boxplot(bxplt_data1,'orientation','horizontal','label',bxplt_lbl,'colors','r','symbol','r+'); legend([p1,p2],M); ***************** Error: ??? Operands to the || and && operators must be convertible to logical scalar values. Error in ==> legend at 198 elseif narg > 0 && ~ischar(varargin{1}) && ... ***************** The above approach works well for the normal plots. I dont know what I am doing wrong with boxplots. |