Mercurial > hg > octave-lojdl
changeset 8222:11badf6c9e9f
__go_draw_axes__.m: Support axes interpreter poperty for tick labels.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Thu, 16 Oct 2008 03:42:40 -0400 |
parents | 06094fa570a3 |
children | 0c91b9a17dcf |
files | scripts/ChangeLog scripts/plot/__go_draw_axes__.m src/ChangeLog src/graphics.h.in |
diffstat | 4 files changed, 40 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2008-10-16 Ben Abbott <bpabbott@mac.com> + + * plot/__go_draw_axes__.m (do_tics_1): New arg, interpreter. + (do_tics): Pass interpreter to do_tics_1. + 2008-10-15 David Bateman <dbateman@free.fr> * general/colon.m: Small typo.
--- a/scripts/plot/__go_draw_axes__.m +++ b/scripts/plot/__go_draw_axes__.m @@ -1360,59 +1360,72 @@ endfunction function do_tics (obj, plot_stream, ymirror, mono) + [fontname, fontsize] = get_fontname_and_size (obj); + if (strcmpi (obj.xaxislocation, "top")) do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "border", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "border", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); elseif (strcmpi (obj.xaxislocation, "zero")) do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "axis", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "axis", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); else do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono, "border", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono, "border", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); endif if (strcmpi (obj.yaxislocation, "right")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "border", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "border", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); elseif (strcmpi (obj.xaxislocation, "zero")) do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "axis", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "axis", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); else do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono, "border", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono, "border", - "", fontname, fontsize); + "", fontname, fontsize, obj.interpreter); endif do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono, "border", - obj.tickdir, fontname, fontsize); + obj.tickdir, fontname, fontsize, obj.interpreter); endfunction function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, plot_stream, mirror, mono, axispos, tickdir, - fontname, fontsize) + fontname, fontsize, interpreter) + persistent warned_latex = false; + if (strcmpi (interpreter, "tex")) + for n = 1 : numel(labels) + labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false); + endfor + elseif (strcmpi (interpreter, "latex")) + if (! warned_latex) + warning ("latex markup not supported for tick marks"); + warned_latex = true; + endif + endif if (strcmp (fontname, "*")) fontspec = ""; else @@ -1538,7 +1551,7 @@ str = __tex2enhanced__ (str, fnt, it, bld); elseif (strcmpi (obj.interpreter, "latex")) if (! warned_latex) - warning ("latex text objects not supported"); + warning ("latex markup not supported for text objects"); warned_latex = true; endif endif
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-10-16 John W. Eaton <jwe@octave.org> + + * graphics.h.in (class axes::properties): New property: interpreter. + 2008-10-15 David Bateman <dbateman@free.fr> * ov-class.c (Fsuperiorto, Finferiorto): Allow more than one class
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -2539,6 +2539,8 @@ // See the genprops.awk script for an explanation of the // properties declarations. + // properties which are not in matlab: interpreter + BEGIN_PROPERTIES(axes) array_property position u , default_axes_position () handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__) @@ -2585,6 +2587,7 @@ radio_property xticklabelmode , "{auto}|manual" radio_property yticklabelmode , "{auto}|manual" radio_property zticklabelmode , "{auto}|manual" + radio_property interpreter , "tex|{none}|latex" color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) color_property xcolor , color_values (0, 0, 0) color_property ycolor , color_values (0, 0, 0)