[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Customizing legends
From: |
Ben Abbott |
Subject: |
Re: Customizing legends |
Date: |
Thu, 13 Dec 2012 14:23:50 -0500 |
On Dec 13, 2012, at 1:09 PM, JaWiB wrote:
> Hi All,
>
> New octave user here. I wanted to plot two sets of curves on the same axes,
> where one set of curves is solid lines and one set of curves is dashed
> lines. Since there are about ten curves in each set, I don't want an entry
> for every curve in the legend, just one entry for the solid lines and one
> entry for the dashed lines. For the life of me, I cannot find a way to do
> this using octave. Any thoughts?
>
> Thanks!
There may not be a perfect solution for your needs. However, provided you have
a recent release of Octave you can pass the handles of the plot objects you'd
like to be included in the legend as the first argument to the legend() command.
h_solid = plot (rand (3));
hold on
h_dashed = plot (rand (3));
set (h_dashed, "linestyle", "--")
legend ([h_solid(1), h_dashed(1)], {"Solid", "Dashed"})
The only problem with this solution is that the colors in the legend are the
same as the referenced plot objects (i.e. you can not change them some
something neutral, like black).
Ben