[Top][All Lists]

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

Re: Legend in scatter plot

From: Daniel Arteaga
Subject: Re: Legend in scatter plot
Date: Thu, 02 Jun 2011 17:46:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; ca-ES; rv: Gecko/20110424 Thunderbird/3.1.10

Al 02/06/11 14:10, En/na Ben Abbott ha escrit:

How can I print a legend in a scatter plot with different colours? A minimal 

color = [0;0.5;1];
scatter([0.15, 1.15 -1.15],[2.15 0 1.15],25,color);

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,


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.

Thank you for the bug report. Unfortunately I cannot test the fltk behaviour since apparently I haven't enabled this graphics backend at compilation time.

Any possible workaround in the meanwhile will be appreciated.

reply via email to

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