From: Anbazhagan on
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
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
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
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
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.
 |  Next  |  Last
Pages: 1 2
Prev: openGL bug
Next: Sptool Spectral analysis