help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Legend in scatter plot


From: Ben Abbott
Subject: Re: Legend in scatter plot
Date: Thu, 02 Jun 2011 08:10:38 -0400

On Jun 2, 2011, at 6:37 AM, Daniel Arteaga wrote:

> Hello,
> 
> How can I print a legend in a scatter plot with different colours? A minimal 
> example:
> 
> color = [0;0.5;1];
> scatter([0.15, 1.15 -1.15],[2.15 0 1.15],25,color);
> legend({"a";"b";"c"});
> 
> The legend does not appear.
> 
> Tested in Octave 3.4.0 compiled from source in Ubuntu 11.04 64 bits.
> 
> Any help  will be appreciated. Thanks,
> 
> Daniel

Looks like a bug.

The code below does work in Matlab.

        color = [0; 0.5; 1];
        h = scatter ([0.15, 1.15, -1.15],[2.15, 0, 1.15], 25, color);
        legend (get (h, 'children'), {'a', 'b', 'c'});

Using your original syntax, the legend entries are associated with the scatter 
object (an hggroup). So only one entry should show. However, this does not work 
for the gnuplot backend. If you switch to FLTK then you'll see the legend, but 
it is not rendered correctly.

        graphics_toolkit fltk
        color = [0; 0.5; 1];
        h = scatter ([0.15, 1.15, -1.15],[2.15, 0, 1.15], 25, color);
        legend (get (h, 'children'), {'a', 'b', 'c'});

I've filed a bug report.

        https://savannah.gnu.org/bugs/index.php?33463

Ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]