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