# HG changeset patch # User Ben Abbott # Date 1327020493 18000 # Node ID 35903f03539082e5e193139b1f8b03f95227c074 # Parent 921b15c13adc9809489a940b731811a987fc797b Escaping strings for legend entries are handled by __go_draw_axes__. Bug # 35330. * __pltopt__.m: Don't escape strings. * legend.m: Add demo and test. diff --git a/scripts/plot/legend.m b/scripts/plot/legend.m --- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -980,6 +980,13 @@ %!demo %! clf %! x = 0:1; +%! plot (x, x, ";\alpha;", +%! x, 2*x, ";\beta=2\alpha;", +%! x, 3*x, ";\gamma=3\alpha;") + +%!demo +%! clf +%! x = 0:1; %! plot (x, x, ";I am Blue;", x, 2*x, x, 3*x, ";I am Red;") %! title ("Blue and Green keys, with Green mising") @@ -1180,3 +1187,20 @@ %! [ax, h1, h2] = plotyy (x, y1, x, y2); %! legend ("Blue", "Green", "location", "south"); +%!test +%! x = 0:10; +%! y = rand (size (x)); +%! displayname = '\alpha_\beta \delta^\theta'; +%! displayname1 = ""; +%! displayname2 = ""; +%! figure (1, "visible", false) +%! unwind_protect +%! h = plot (x, y, sprintf (";%s;", displayname)); +%! displayname1 = get (h, "displayname") +%! hlegend = legend (h, displayname, "location", "south"); +%! displayname2 = get (h, "displayname") +%! unwind_protect_cleanup +%! close (gcf; +%! end_unwind_protect +%! assert (displayname1, displayname) +%! assert (displayname2, displayname) diff --git a/scripts/plot/private/__pltopt__.m b/scripts/plot/private/__pltopt__.m --- a/scripts/plot/private/__pltopt__.m +++ b/scripts/plot/private/__pltopt__.m @@ -206,7 +206,7 @@ elseif (topt == ";") t = index (opt(2:end), ";"); if (t) - options.key = undo_string_escapes (opt(2:t)); + options.key = opt(2:t); n = t+1; else if (err_on_invalid)