Mercurial > octave-dspies
diff scripts/plot/private/__go_draw_axes__.m @ 14868:5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
* lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m,
colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m,
int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m,
__isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m,
rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m,
inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m,
gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m,
ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m,
compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m,
getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m,
__xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m,
fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m,
copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m,
installed_packages.m, is_architecture_dependent.m, load_package_dirs.m,
print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m,
allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m,
comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m,
fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m,
mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m,
polar.m, print.m, __add_datasource__.m, __add_default_menu__.m,
__axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m,
__errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m,
__ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m,
__go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m,
__pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m,
__stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m,
__uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m,
ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m,
surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m,
mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m,
ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m,
addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m,
arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m,
hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m,
stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m,
__sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m,
treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m,
magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m,
quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m,
bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m,
kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m,
z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m,
strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m,
test.m, now.m: Use Octave coding conventions for cuddling parentheses in
scripts directory.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 17 Jul 2012 07:08:39 -0700 |
parents | 355ff41f3f97 |
children | c2dbdeaa25df |
line wrap: on
line diff
--- a/scripts/plot/private/__go_draw_axes__.m Mon Jul 16 20:37:01 2012 -0400 +++ b/scripts/plot/private/__go_draw_axes__.m Tue Jul 17 07:08:39 2012 -0700 @@ -90,7 +90,7 @@ x = [1, 1]; else ## 3D plots need to be sized down to fit in the window. - x = 1.0 ./ sqrt([2, 2.5]); + x = 1.0 ./ sqrt ([2, 2.5]); endif fprintf (plot_stream, "set tmargin screen %.15g;\n", pos(2)+pos(4)/2+x(2)*pos(4)/2); @@ -574,7 +574,7 @@ ydat = obj.ydata(:); data{data_idx} = [xdat, ydat]'; usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes %s%s", - rows(xdat), xaxisloc_using, yaxisloc_using); + rows (xdat), xaxisloc_using, yaxisloc_using); endif style = do_linestyle_command (obj, obj.color, data_idx, mono, @@ -714,7 +714,7 @@ if (nd == 3 && numel (xcol) == 3) ccdat = ccol; if (! isvector (ccdat)) - tmp = rows(cmap) + rows(addedcmap) + ... + tmp = rows (cmap) + rows (addedcmap) + ... [1 : rows(ccdat)]; addedcmap = [addedcmap; ccdat]; ccdat = tmp(:); @@ -746,7 +746,7 @@ if (nd == 3 && numel (xcol) == 3) if (isnan (ccdat)) - ccdat = (rows (cmap) + rows(addedcmap) + 1) * ones(3, 1); + ccdat = (rows (cmap) + rows (addedcmap) + 1) * ones(3, 1); addedcmap = [addedcmap; reshape(color, 1, 3)]; endif data{data_3d_idx} = [data{data_3d_idx}, ... @@ -827,22 +827,22 @@ ccol = cdat; endif if (strncmp (ec, "flat", 4)) - if (numel(ccol) == 3) + if (numel (ccol) == 3) color = ccol; else if (isscalar (ccol)) - ccol = repmat(ccol, numel (xcol), 1); + ccol = repmat (ccol, numel (xcol), 1); endif color = "flat"; have_cdata(data_idx) = true; endif elseif (strncmp (ec, "interp", 6)) - if (numel(ccol) == 3) + if (numel (ccol) == 3) warning ("\"interp\" not supported, using 1st entry of cdata"); color = ccol(1,:); else if (isscalar (ccol)) - ccol = repmat(ccol, numel (xcol), 1); + ccol = repmat (ccol, numel (xcol), 1); endif color = "interp"; have_cdata(data_idx) = true; @@ -877,7 +877,7 @@ endif if (isfield (obj, "linewidth")) - lw = sprintf("linewidth %f", obj.linewidth); + lw = sprintf ("linewidth %f", obj.linewidth); else lw = ""; endif @@ -923,7 +923,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -950,7 +950,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -977,7 +977,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -987,7 +987,7 @@ endif else if (!isempty (style)) - if (length(tmpwith) < sidx || isempty (tmpwith{sidx})) + if (length (tmpwith) < sidx || isempty (tmpwith{sidx})) tmpwith{sidx} = sprintf ("with %s %s %s %s", style, lw, lt, colorspec); @@ -1012,7 +1012,7 @@ else m = mdat; endif - ps = sprintf("pointsize %f", m / 3); + ps = sprintf ("pointsize %f", m / 3); else ps = ""; endif @@ -1122,7 +1122,7 @@ cdat = obj.cdata; err = false; - if (! size_equal(zdat, cdat)) + if (! size_equal (zdat, cdat)) err = true; endif if (isvector (xdat) && isvector (ydat) && ismatrix (zdat)) @@ -1188,11 +1188,11 @@ if (all (obj.facecolor == 1)) hidden_removal = true; endif - fputs(plot_stream,"unset pm3d;\n"); - fputs(plot_stream,"set style increment user;\n"); + fputs (plot_stream,"unset pm3d;\n"); + fputs (plot_stream,"set style increment user;\n"); withpm3d = false; - withclause{data_idx} = sprintf("with %s linestyle %d", - style{1}, data_idx); + withclause{data_idx} = sprintf ("with %s linestyle %d", + style{1}, data_idx); fputs (plot_stream, "unset pm3d\n"); endif @@ -1267,7 +1267,7 @@ style{3}, data_idx); endif if (withpm3d && strncmp (style {1}, "linespoints", 11)) - if (isempty(zz)) + if (isempty (zz)) len = 3 * xlen; zz = zeros (ylen, len); k = 1; @@ -1335,7 +1335,7 @@ ## Gnuplot's Character units are different for x/y and vary with fontsize. The aspect ratio ## of 1:1.7 was determined by experiment to work for eps/ps/etc. For the MacOS aqua terminal ## a value of 2.5 is needed. However, the difference is barely noticable. - dx_and_dy = [(-dy * sind (angle)), (dy * cosd(angle))] .* [1.7 1]; + dx_and_dy = [(-dy * sind (angle)), (dy * cosd (angle))] .* [1.7 1]; ## FIXME - Multiline text produced the gnuplot "warning: ft_render: skipping glyph" if (nd == 3) @@ -1376,7 +1376,7 @@ fputs (plot_stream, "set pm3d explicit;\n"); endif - if (isnan(hidden_removal) || hidden_removal) + if (isnan (hidden_removal) || hidden_removal) fputs (plot_stream, "set hidden3d;\n"); else fputs (plot_stream, "unset hidden3d;\n"); @@ -1425,17 +1425,17 @@ endif cmap = parent_figure_obj.colormap; - cmap_sz = rows(cmap); + cmap_sz = rows (cmap); if (! any (isinf (clim))) if (truecolor || ! cdatadirect) - if (rows(addedcmap) > 0) + if (rows (addedcmap) > 0) for i = 1:data_idx if (have_3d_patch(i)) data{i}(end,:) = clim(2) * (data{i}(end, :) - 0.5) / cmap_sz; endif endfor fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim(1), clim(2) * - (cmap_sz + rows(addedcmap)) / cmap_sz); + (cmap_sz + rows (addedcmap)) / cmap_sz); else fprintf (plot_stream, "set cbrange [%.15e:%.15e];\n", clim); endif @@ -1590,8 +1590,8 @@ fputs (plot_stream, "set style data lines;\n"); cmap = [cmap; addedcmap]; - cmap_sz = cmap_sz + rows(addedcmap); - if (length(cmap) > 0) + cmap_sz = cmap_sz + rows (addedcmap); + if (length (cmap) > 0) fprintf (plot_stream, "set palette positive color model RGB maxcolors %i;\n", cmap_sz); @@ -1629,7 +1629,7 @@ if (numel (is_image_data) > 1 && is_image_data(2)) ## Remove terminating semicolon n = max (strfind (withclause{1}, ";")); - if (! isempty(n)) + if (! isempty (n)) withclause{1} = withclause{1}(1:n-1); endif endif @@ -1657,7 +1657,7 @@ if (numel (is_image_data) > i && is_image_data(i+1)) ## Remove terminating semicolon n = max (strfind (withclause{i}, ";")); - if (! isempty(n)) + if (! isempty (n)) withclause{i} = withclause{i}(1:n-1); endif endif @@ -1690,7 +1690,7 @@ ## Can't write 3d patch data as binary as can't plot more than ## a single patch at a time and have to plot all patches together ## so that the gnuplot depth ordering is done correctly - for j = 1 : 4 : columns(data{i}) + for j = 1 : 4 : columns (data{i}) if (j != 1) fputs (plot_stream, "\n\n"); endif @@ -2097,7 +2097,7 @@ fontname, fontspec, interpreter, scale, sgn, gnuplot_term) persistent warned_latex = false; if (strcmpi (interpreter, "tex")) - for n = 1 : numel(labels) + for n = 1 : numel (labels) labels{n} = __tex2enhanced__ (labels{n}, fontname, false, false); endfor elseif (strcmpi (interpreter, "latex")) @@ -2147,7 +2147,7 @@ tickdir, ticklength, axispos); endif - labels = regexprep(labels, '%', "%%"); + labels = regexprep (labels, '%', "%%"); for i = 1:ntics fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i)); if (i < ntics) @@ -2237,7 +2237,7 @@ it = false; bld = false; if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold")) - if (! isempty(t.fontangle) + if (! isempty (t.fontangle) && (strcmpi (t.fontangle, "italic") || strcmpi (t.fontangle, "oblique"))) f = cstrcat (f, "-bolditalic"); @@ -2247,7 +2247,7 @@ f = cstrcat (f, "-bold"); bld = true; endif - elseif (! isempty(t.fontangle) + elseif (! isempty (t.fontangle) && (strcmpi (t.fontangle, "italic") || strcmpi (t.fontangle, "oblique"))) f = cstrcat (f, "-italic"); @@ -2282,7 +2282,7 @@ str = cellstr (num2str (str(:))); endif if (iscellstr (str)) - for n = 1:numel(str) + for n = 1:numel (str) if (isnumeric (str{n})) str{n} = num2str (str{n}); endif @@ -2293,7 +2293,7 @@ if (enhanced) if (strcmpi (obj.interpreter, "tex")) if (iscellstr (str)) - for n = 1:numel(str) + for n = 1:numel (str) str{n} = __tex2enhanced__ (str{n}, fnt, it, bld); endfor else @@ -2317,14 +2317,14 @@ labels = cellstr (str); endif for marker = "_^" - for m = 1 : numel(labels) + for m = 1 : numel (labels) n1 = strfind (labels{m}, sprintf ("\\%s", marker)); n2 = strfind (labels{m}, marker); if (! isempty (n1)) n1 = n1 + 1; n2 = setdiff (n2, n1); endif - for n = numel(n2):-1:1 + for n = numel (n2):-1:1 labels{m} = [labels{m}(1:n2(n)-1), "\\", labels{m}(n2(n):end)]; endfor endfor @@ -2340,7 +2340,7 @@ persistent sym = __setup_sym_table__ (); persistent flds = fieldnames (sym); - [s, e, m] = regexp(str,'\\\\([a-zA-Z]+|0)','start','end','matches'); + [s, e, m] = regexp (str,'\\\\([a-zA-Z]+|0)','start','end','matches'); for i = length (s) : -1 : 1 ## special case for "\0" and replace with "{/Symbol \306}' @@ -2349,7 +2349,7 @@ else f = m{i}(2:end); if (isfield (sym, f)) - g = getfield(sym, f); + g = getfield (sym, f); ## FIXME The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) @@ -2369,54 +2369,54 @@ it = true; if (bld) str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); else str = cstrcat (str(1:s(i) - 1), '/', fnt, '-italic ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); endif elseif (strncmp (f, "bf", 2)) bld = true; if (it) str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bolditalic ', - str(2(i) + 3:end)); + str(2(i) + 3:end)); else str = cstrcat (str(1:s(i) - 1), '/', fnt, '-bold ', - str(s(i) + 3:end)); + str(s(i) + 3:end)); endif elseif (strcmpi (f, "color")) ## FIXME Ignore \color but remove trailing {} block as well - d = strfind(str(e(i) + 1:end),'}'); + d = strfind (str(e(i) + 1:end),'}'); if (isempty (d)) warning ('syntax error in \color argument'); else str = cstrcat (str(1:s(i) - 1), str(e(i) + d + 1:end)); endif - elseif(strcmpi (f, "fontname")) - b1 = strfind(str(e(i) + 1:end),'{'); - b2 = strfind(str(e(i) + 1:end),'}'); - if (isempty(b1) || isempty(b2)) + elseif (strcmpi (f, "fontname")) + b1 = strfind (str(e(i) + 1:end),'{'); + b2 = strfind (str(e(i) + 1:end),'}'); + if (isempty (b1) || isempty (b2)) warning ('syntax error in \fontname argument'); else str = cstrcat (str(1:s(i) - 1), '/', - str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', - str(e(i) + b2(1) + 1:end)); + str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', + str(e(i) + b2(1) + 1:end)); endif - elseif(strcmpi (f, "fontsize")) - b1 = strfind(str(e(i) + 1:end),'{'); - b2 = strfind(str(e(i) + 1:end),'}'); - if (isempty(b1) || isempty(b2)) + elseif (strcmpi (f, "fontsize")) + b1 = strfind (str(e(i) + 1:end),'{'); + b2 = strfind (str(e(i) + 1:end),'}'); + if (isempty (b1) || isempty (b2)) warning ('syntax error in \fontname argument'); else str = cstrcat (str(1:s(i) - 1), '/=', - str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', - str(e(i) + b2(1) + 1:end)); + str(e(i)+b1(1) + 1:e(i)+b2(1)-1), '{}', + str(e(i) + b2(1) + 1:end)); endif else ## Last desperate attempt to treat the symbol. Look for things ## like \pix, that should be translated to the symbol Pi and x for j = 1 : length (flds) if (strncmp (flds{j}, f, length (flds{j}))) - g = getfield(sym, flds{j}); + g = getfield (sym, flds{j}); ## FIXME The symbol font doesn't seem to support bold or italic ##if (bld) ## if (it) @@ -2428,7 +2428,7 @@ ## g = regexprep (g, '/Symbol', '/Symbol-italic'); ##endif str = cstrcat (str(1:s(i) - 1), g, - str(s(i) + length (flds{j}) + 1:end)); + str(s(i) + length (flds{j}) + 1:end)); break; endif endfor @@ -2444,15 +2444,15 @@ ## FIXME -- This is a mess... Is it worth it just for a "@" character? - [s, m] = regexp(str,'[_\^]','start','matches'); + [s, m] = regexp (str,'[_\^]','start','matches'); i = 1; p = 0; while (i < length (s)) - if (i < length(s)) + if (i < length (s)) if (str(s(i) + p + 1) == "{") - s1 = strfind(str(s(i) + p + 2:end),'{'); + s1 = strfind (str(s(i) + p + 2:end),'{'); si = 1; - l1 = strfind(str(s(i) + p + 1:end),'}'); + l1 = strfind (str(s(i) + p + 1:end),'}'); li = 1; while (li <= length (l1) && si <= length (s1)) if (l1(li) < s1(si)) @@ -2464,12 +2464,12 @@ si++; endif endwhile - l1 = l1 (min (length(l1), si)); + l1 = l1 (min (length (l1), si)); if (s(i) + l1 + 1 == s(i+1)) if (str(s(i + 1) + p + 1) == "{") - s2 = strfind(str(s(i + 1) + p + 2:end),'{'); + s2 = strfind (str(s(i + 1) + p + 2:end),'{'); si = 1; - l2 = strfind(str(s(i + 1) + p + 1:end),'}'); + l2 = strfind (str(s(i + 1) + p + 1:end),'}'); li = 1; while (li <= length (l2) && si <= length (s2)) if (l2(li) < s2(si)) @@ -2481,20 +2481,20 @@ si++; endif endwhile - l2 = l2 (min (length(l2), si)); + l2 = l2 (min (length (l2), si)); if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <= - length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1))) + length_string (str(s(i+1)+p+2:s(i+1)+p+l2-1))) ## Shortest already first! str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end)); else ## Have to swap sub/super-script to get shortest first. str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2), - str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); + str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end)); endif else ## Have to swap sub/super-script to get shortest first. str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1), - str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); + str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end)); endif i += 2; p ++; @@ -2519,7 +2519,7 @@ endfunction function l = length_string (s) - l = length (s) - length (strfind(s,'{')) - length (strfind(s,'}')); + l = length (s) - length (strfind (s,'{')) - length (strfind (s,'}')); m = regexp (s, '/([\w-]+|[\w-]+=\d+)', 'matches'); if (!isempty (m)) l = l - sum (cellfun ("length", m));