Color and legend for stem() and stairs()
Christoph Dalitz
christoph.dalitz at hs-niederrhein.de
Mon Oct 20 07:36:15 CDT 2008
Hallo,
as the plot styles 'L' and '^' are apparently no longer supported
in Octave >= 2.9, I try to achieve the same with stairs() and stem().
Unlike for the plot() function, there seems however be no way to attach
a legend or a line color to a stair() or stem() plot.
I have tried the following:
hold on;
stem(x,y);
stairs(x,z);
legend("y(x)", "z(x)");
hold off;
This results in the stem plot being red, the stairs plot being blue and
the legend lines being *both* red.
I wonder whether a workaround might be to explicitly set colors for
both plots, but unlike with the plot() command, there seems to be
no way to change the color of a stem() or stairs() plot, nor is there
a way to directly attach a title (legend string) to a stairs() or stem()
plot.
Any hints are welcome,
Christoph
More information about the Help-octave
mailing list