Mercurial > hg > octave-nkf
comparison scripts/plot/util/private/__go_draw_axes__.m @ 19047:7bbe3658c5ef
maint: Use "FIXME:" coding convention in m-files.
* flipdim.m, prepad.m, rotdim.m, doc.m, strread.m, textread.m, krylov.m,
colon.m, dump_prefs.m, fileattrib.m, getappdata.m, __xzip__.m, unpack.m,
fsolve.m, axis.m, meshc.m, print.m, __ghostscript__.m, __go_draw_axes__.m,
__print_parse_opts__.m, struct2hdl.m, unique.m, spstats.m, treeplot.m, test.m,
datestr.m: Use "FIXME:" coding convention in m-files.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 25 Jun 2014 13:45:41 -0700 |
parents | 0dae39867b2b |
children | 04dc55bf71e8 |
comparison
equal
deleted
inserted
replaced
19046:de8c67ba7ac4 | 19047:7bbe3658c5ef |
---|---|
61 | 61 |
62 if (strcmp (axis_obj.dataaspectratiomode, "manual") | 62 if (strcmp (axis_obj.dataaspectratiomode, "manual") |
63 && strcmp (axis_obj.xlimmode, "manual") | 63 && strcmp (axis_obj.xlimmode, "manual") |
64 && strcmp (axis_obj.ylimmode, "manual") | 64 && strcmp (axis_obj.ylimmode, "manual") |
65 && (nd == 2 || all (mod (axis_obj.view, 90) == 0))) | 65 && (nd == 2 || all (mod (axis_obj.view, 90) == 0))) |
66 ## FIXME - adjust plotboxaspectratio to respect other | 66 ## FIXME: adjust plotboxaspectratio to respect other |
67 fpos = get (axis_obj.parent, "position"); | 67 fpos = get (axis_obj.parent, "position"); |
68 apos = axis_obj.position; | 68 apos = axis_obj.position; |
69 endif | 69 endif |
70 | 70 |
71 pos = __actual_axis_position__ (h); | 71 pos = __actual_axis_position__ (h); |
73 if (strcmpi (axis_obj.dataaspectratiomode, "manual")) | 73 if (strcmpi (axis_obj.dataaspectratiomode, "manual")) |
74 dr = axis_obj.dataaspectratio; | 74 dr = axis_obj.dataaspectratio; |
75 if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) | 75 if (nd == 2 || all (mod (axis_obj.view, 90) == 0)) |
76 dr = dr(1) / dr(2); | 76 dr = dr(1) / dr(2); |
77 else | 77 else |
78 ## FIXME - need to properly implement 3D | 78 ## FIXME: need to properly implement 3D |
79 dr = mean (dr(1:2)) / dr(3); | 79 dr = mean (dr(1:2)) / dr(3); |
80 endif | 80 endif |
81 else | 81 else |
82 dr = 1; | 82 dr = 1; |
83 endif | 83 endif |
104 fprintf (plot_stream, "set bmargin 0;\n"); | 104 fprintf (plot_stream, "set bmargin 0;\n"); |
105 fprintf (plot_stream, "set lmargin 0;\n"); | 105 fprintf (plot_stream, "set lmargin 0;\n"); |
106 fprintf (plot_stream, "set rmargin 0;\n"); | 106 fprintf (plot_stream, "set rmargin 0;\n"); |
107 | 107 |
108 if (nd == 3 && all (axis_obj.view == [0, 90])) | 108 if (nd == 3 && all (axis_obj.view == [0, 90])) |
109 ## FIXME -- Kludge to allow colorbar to be added to a pcolor() plot | 109 ## FIXME: Kludge to allow colorbar to be added to a pcolor() plot |
110 pos(3:4) = pos(3:4) * 1.4; | 110 pos(3:4) = pos(3:4) * 1.4; |
111 pos(1:2) = pos(1:2) - pos(3:4) * 0.125; | 111 pos(1:2) = pos(1:2) - pos(3:4) * 0.125; |
112 endif | 112 endif |
113 | 113 |
114 fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); | 114 fprintf (plot_stream, "set origin %.15g, %.15g;\n", pos(1), pos(2)); |
137 if (! isempty (sz_str)) | 137 if (! isempty (sz_str)) |
138 fputs (plot_stream, sz_str); | 138 fputs (plot_stream, sz_str); |
139 endif | 139 endif |
140 | 140 |
141 ## Reset all labels, axis-labels, tick-labels, and title | 141 ## Reset all labels, axis-labels, tick-labels, and title |
142 ## FIXME - We should have an function to initialize the axis. | 142 ## FIXME: We should have an function to initialize the axis. |
143 ## Presently, this is dispersed in this function. | 143 ## Presently, this is dispersed in this function. |
144 fputs (plot_stream, "unset label;\n"); | 144 fputs (plot_stream, "unset label;\n"); |
145 fputs (plot_stream, "unset xtics;\n"); | 145 fputs (plot_stream, "unset xtics;\n"); |
146 fputs (plot_stream, "unset ytics;\n"); | 146 fputs (plot_stream, "unset ytics;\n"); |
147 fputs (plot_stream, "unset ztics;\n"); | 147 fputs (plot_stream, "unset ztics;\n"); |
148 fputs (plot_stream, "unset x2tics;\n"); | 148 fputs (plot_stream, "unset x2tics;\n"); |
321 if (strcmpi (axis_obj.layer, "top")) | 321 if (strcmpi (axis_obj.layer, "top")) |
322 fputs (plot_stream, "set grid front;\n"); | 322 fputs (plot_stream, "set grid front;\n"); |
323 fputs (plot_stream, "set border front;\n"); | 323 fputs (plot_stream, "set border front;\n"); |
324 else | 324 else |
325 fputs (plot_stream, "set grid layerdefault;\n"); | 325 fputs (plot_stream, "set grid layerdefault;\n"); |
326 ## FIXME -- the gnuplot help says that "layerdefault" should work | 326 ## FIXME: The gnuplot help says that "layerdefault" should work |
327 ## for set border too, but it fails for me with gnuplot 4.2.5. So | 327 ## for set border too, but it fails for me with gnuplot 4.2.5. |
328 ## use "back" instead. | 328 ## So, use "back" instead. |
329 fputs (plot_stream, "set border back;\n"); | 329 fputs (plot_stream, "set border back;\n"); |
330 endif | 330 endif |
331 | 331 |
332 fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n", | 332 fprintf (plot_stream, "set grid linewidth %f, linewidth %f;\n", |
333 axis_obj.linewidth, axis_obj.linewidth); | 333 axis_obj.linewidth, axis_obj.linewidth); |
798 if (isfield (obj, "markersize")) | 798 if (isfield (obj, "markersize")) |
799 mdat = obj.markersize / 3; | 799 mdat = obj.markersize / 3; |
800 endif | 800 endif |
801 | 801 |
802 if (isfield (obj, "edgecolor")) | 802 if (isfield (obj, "edgecolor")) |
803 ## FIXME | 803 ## FIXME: This is the wrong thing to do as edgecolor, |
804 ## This is the wrong thing to do as edgecolor, markeredgecolor | 804 ## markeredgecolor and markerfacecolor can have different values |
805 ## and markerfacecolor can have different values and we should | 805 ## and we should treat them seperately. However, the code below |
806 ## treat them seperately. However, the below allow the scatter | 806 ## allows the scatter functions to work as expected, where only |
807 ## functions to work as expected, where only one of these values | 807 ## one of these values is set. |
808 ## is set | |
809 if (strcmp (obj.edgecolor, "none")) | 808 if (strcmp (obj.edgecolor, "none")) |
810 if (strcmp (obj.markeredgecolor, "none")) | 809 if (strcmp (obj.markeredgecolor, "none")) |
811 ec = obj.markerfacecolor; | 810 ec = obj.markerfacecolor; |
812 else | 811 else |
813 ec = obj.markeredgecolor; | 812 ec = obj.markeredgecolor; |
1967 pt2 = "9"; | 1966 pt2 = "9"; |
1968 case "v" | 1967 case "v" |
1969 pt = "10"; | 1968 pt = "10"; |
1970 pt2 = "11"; | 1969 pt2 = "11"; |
1971 case ">" | 1970 case ">" |
1972 ## FIXME: should be triangle pointing right, use triangle pointing up | 1971 ## FIXME: Should be triangle pointing right, use triangle pointing up |
1973 pt = "8"; | 1972 pt = "8"; |
1974 pt2 = "9"; | 1973 pt2 = "9"; |
1975 case "<" | 1974 case "<" |
1976 ## FIXME: should be triangle pointing left, use triangle pointing down | 1975 ## FIXME: Should be triangle pointing left, use triangle pointing down |
1977 pt = "10"; | 1976 pt = "10"; |
1978 pt2 = "11"; | 1977 pt2 = "11"; |
1979 case {"pentagram", "p"} | 1978 case {"pentagram", "p"} |
1980 ## FIXME: should be pentagram, using pentagon | 1979 ## FIXME: Should be pentagram, using pentagon |
1981 pt = "14"; | 1980 pt = "14"; |
1982 pt2 = "15"; | 1981 pt2 = "15"; |
1983 case {"hexagram", "h"} | 1982 case {"hexagram", "h"} |
1984 ## FIXME: should be 6 pt start, using "*" instead | 1983 ## FIXME: Should be 6 pt start, using "*" instead |
1985 pt = pt2 = "3"; | 1984 pt = pt2 = "3"; |
1986 case "none" | 1985 case "none" |
1987 pt = pt2 = ""; | 1986 pt = pt2 = ""; |
1988 otherwise | 1987 otherwise |
1989 pt = pt2 = ""; | 1988 pt = pt2 = ""; |
1995 | 1994 |
1996 function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) | 1995 function __gnuplot_write_data__ (plot_stream, data, nd, parametric, cdata) |
1997 | 1996 |
1998 ## DATA is already transposed. | 1997 ## DATA is already transposed. |
1999 | 1998 |
2000 ## FIXME -- this may need to be converted to C++ for speed. | 1999 ## FIXME: this may need to be converted to C++ for speed. |
2001 | 2000 |
2002 ## Convert NA elements to normal NaN values because fprintf writes | 2001 ## Convert NA elements to normal NaN values because fprintf writes |
2003 ## "NA" and that confuses gnuplot. | 2002 ## "NA" and that confuses gnuplot. |
2004 idx = find (isna (data)); | 2003 idx = find (isna (data)); |
2005 if (any (idx)) | 2004 if (any (idx)) |
2296 str = [str(1:s(i) - 1) '{/Symbol \306}' str(s(i) + 2:end)]; | 2295 str = [str(1:s(i) - 1) '{/Symbol \306}' str(s(i) + 2:end)]; |
2297 else | 2296 else |
2298 f = m{i}(2:end); | 2297 f = m{i}(2:end); |
2299 if (isfield (sym, f)) | 2298 if (isfield (sym, f)) |
2300 g = getfield (sym, f); | 2299 g = getfield (sym, f); |
2301 ## FIXME The symbol font doesn't seem to support bold or italic | 2300 ## FIXME: The symbol font doesn't seem to support bold or italic |
2302 ##if (bld) | 2301 ##if (bld) |
2303 ## if (it) | 2302 ## if (it) |
2304 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | 2303 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); |
2305 ## else | 2304 ## else |
2306 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | 2305 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); |
2326 str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)]; | 2325 str = [str(1:s(i) - 1) '/' fnt '-bolditalic ' str(s(i) + 3:end)]; |
2327 else | 2326 else |
2328 str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)]; | 2327 str = [str(1:s(i) - 1) '/' fnt '-bold ' str(s(i) + 3:end)]; |
2329 endif | 2328 endif |
2330 elseif (strcmpi (f, "color")) | 2329 elseif (strcmpi (f, "color")) |
2331 ## FIXME Ignore \color but remove trailing {} block as well | 2330 ## FIXME: Ignore \color but remove trailing {} block as well |
2332 d = strfind (str(e(i) + 1:end),'}'); | 2331 d = strfind (str(e(i) + 1:end),'}'); |
2333 if (isempty (d)) | 2332 if (isempty (d)) |
2334 warning ('syntax error in \color argument'); | 2333 warning ('syntax error in \color argument'); |
2335 else | 2334 else |
2336 str = [str(1:s(i) - 1) str(e(i) + d + 1:end)]; | 2335 str = [str(1:s(i) - 1) str(e(i) + d + 1:end)]; |
2357 ## Last desperate attempt to treat the symbol. Look for things | 2356 ## Last desperate attempt to treat the symbol. Look for things |
2358 ## like \pix, that should be translated to the symbol Pi and x | 2357 ## like \pix, that should be translated to the symbol Pi and x |
2359 for j = 1 : length (flds) | 2358 for j = 1 : length (flds) |
2360 if (strncmp (flds{j}, f, length (flds{j}))) | 2359 if (strncmp (flds{j}, f, length (flds{j}))) |
2361 g = getfield (sym, flds{j}); | 2360 g = getfield (sym, flds{j}); |
2362 ## FIXME The symbol font doesn't seem to support bold or italic | 2361 ## FIXME: The symbol font doesn't seem to support bold or italic |
2363 ##if (bld) | 2362 ##if (bld) |
2364 ## if (it) | 2363 ## if (it) |
2365 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); | 2364 ## g = regexprep (g, '/Symbol', '/Symbol-bolditalic'); |
2366 ## else | 2365 ## else |
2367 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); | 2366 ## g = regexprep (g, '/Symbol', '/Symbol-bold'); |
2381 ## alignment But need to put the shorter of the two arguments first. | 2380 ## alignment But need to put the shorter of the two arguments first. |
2382 ## Carful of nested {} and unprinted characters when defining | 2381 ## Carful of nested {} and unprinted characters when defining |
2383 ## shortest.. Don't have to worry about things like ^\theta as they | 2382 ## shortest.. Don't have to worry about things like ^\theta as they |
2384 ## are already converted to ^{/Symbol q}. | 2383 ## are already converted to ^{/Symbol q}. |
2385 | 2384 |
2386 ## FIXME -- This is a mess... Is it worth it just for a "@" character? | 2385 ## FIXME: This is a mess... Is it worth it just for a "@" character? |
2387 | 2386 |
2388 [s, m] = regexp (str,'[_\^]','start','matches'); | 2387 [s, m] = regexp (str,'[_\^]','start','matches'); |
2389 i = 1; | 2388 i = 1; |
2390 p = 0; | 2389 p = 0; |
2391 while (i < length (s)) | 2390 while (i < length (s)) |