how to avoid '_' interpretation in plot legend ?

Ben Abbott bpabbott at mac.com
Mon Jul 6 09:40:32 CDT 2009


On Monday, July 06, 2009, at 08:59AM, "Sergei Steshenko" <sergstesh at yahoo.com> wrote:
>
>Hello,
>
>if I enter, say, the following command:
>
>plot(1:10, 1:10, "-;foo_bar;1");
>
>, I'm getting straight red line plotted (and this is expected), but the 
>legend says
>
>foobar
>
>with 'b' being below the rest of characters and having smaller size - 
>instead of the expected
>
>foo_bar.
>
>
>I think I should use some kind of 'set' command, but "help set" does not
>provide particular info.
>
>
>I know that for titles I should use
>
>set(title("foo_bar"), "Interpreter", "none");
>
>, but I do not know what to use for legends.
>
>Thanks,
>  Sergei.

Looks like a bug to me. I can't presently run the developers sources, but I see the same effect in 3.2.

The proper fix would be to properly implement the legend as a separate axes object, and have the text labels inherit their parent's interpreter property.

Until then it would be possible to (1) change the legend interpreter to "none", or (2) have the legend inherit the interpreter of its axes.

For a quick fix, and if you don't mind the console error it produces, you can try the change below

    plot(1:10, 1:10, "-;foo{_}bar;1");

Ben



More information about the Help-octave mailing list