# HG changeset patch # User jwe # Date 812950811 0 # Node ID 47bd45a30ddae72251d7469f74ca30be0b432b37 # Parent 749b8b19733fe62d039ba7d95815bc0cd726abcb [project @ 1995-10-06 03:40:11 by jwe] diff -r 749b8b19733f -r 47bd45a30dda scripts/plot/mplot.m --- a/scripts/plot/mplot.m Fri Oct 06 03:10:34 1995 +0000 +++ b/scripts/plot/mplot.m Fri Oct 06 03:40:11 1995 +0000 @@ -38,9 +38,9 @@ # global variables to keep track of multiplot options global multiplot_mode - global multi_xsize multi_ysize - global multi_xn multi_yn - global multi_xi multi_yi + global multiplot_xsize multiplot_ysize + global multiplot_xn multiplot_yn + global multiplot_xi multiplot_yi # This is a real kludge. We gnuplot should be made so that replot can # be executed while doing multiple plots... @@ -63,19 +63,19 @@ if (multiplot_mode) - if (multi_xi < multi_xn) - multi_xi++; + if (multiplot_xi < multiplot_xn) + multiplot_xi++; else - multi_xi = 1; - if (multi_yi < multi_xn) - multi_yi++; + multiplot_xi = 1; + if (multiplot_yi < multiplot_xn) + multiplot_yi++; else - multi_yi = 1; + multiplot_yi = 1; endif endif - xo = (multi_xi - 1.0)*multi_xsize; - yo = (multi_yn - multi_yi)*multi_ysize; + xo = (multiplot_xi - 1.0)*multiplot_xsize; + yo = (multiplot_yn - multiplot_yi)*multiplot_ysize; eval (sprintf ("set origin %g, %g", xo,yo)); diff -r 749b8b19733f -r 47bd45a30dda scripts/plot/multiplot.m --- a/scripts/plot/multiplot.m Fri Oct 06 03:10:34 1995 +0000 +++ b/scripts/plot/multiplot.m Fri Oct 06 03:40:11 1995 +0000 @@ -35,9 +35,9 @@ # global variables to keep track of multiplot options global multiplot_mode - global multi_xsize multi_ysize - global multi_xn multi_yn - global multi_xi multi_yi + global multiplot_xsize multiplot_ysize + global multiplot_xn multiplot_yn + global multiplot_xi multiplot_yi # This is a real kludge. We gnuplot should be made so that replot can # be executed while doing multiple plots... @@ -69,12 +69,12 @@ set origin 0,0 multiplot_mode = 0; - multi_xsize = 1; - multi_ysize = 1; - multi_xn = 1; - multi_yn = 1; - multi_xi = 1; - multi_yi = 1; + multiplot_xsize = 1; + multiplot_ysize = 1; + multiplot_xn = 1; + multiplot_yn = 1; + multiplot_xi = 1; + multiplot_yi = 1; # Someone may have reset it betweeen calls... @@ -103,12 +103,12 @@ eval (sprintf ("set origin %g, %g", xo, yo)); multiplot_mode = 1; - multi_xsize = xsize; - multi_ysize = ysize; - multi_xn = xn; - multi_yn = yn; - multi_xi = 1; - multi_yi = 1; + multiplot_xsize = xsize; + multiplot_ysize = ysize; + multiplot_xn = xn; + multiplot_yn = yn; + multiplot_xi = 1; + multiplot_yi = 1; endif diff -r 749b8b19733f -r 47bd45a30dda scripts/plot/subplot.m --- a/scripts/plot/subplot.m Fri Oct 06 03:10:34 1995 +0000 +++ b/scripts/plot/subplot.m Fri Oct 06 03:40:11 1995 +0000 @@ -60,9 +60,9 @@ # global variables to keep track of multiplot options global multiplot_mode - global multi_xsize multi_ysize - global multi_xn multi_yn - global multi_xi multi_yi + global multiplot_xsize multiplot_ysize + global multiplot_xn multiplot_yn + global multiplot_xi multiplot_yi # This is a real kludge. We gnuplot should be made so that replot can # be executed while doing multiple plots... @@ -82,14 +82,16 @@ if (nargin == 1) - if (! is_scalar (rows)) - error ("subplot: input rcn has to be a scalar"); + if (! (is_scalar (rows) && rows >= 0)) + error ("subplot: input rcn has to be a positive scalar"); endif - xnp = rows; - rows = round (xnp/100); - columns = round ((xnp - 100*rows)/10); - index = xnp - 10*columns - 100*rows; + tmp = rows; + index = rem (tmp, 10); + tmp = (tmp - index) / 10; + columns = rem (tmp, 10); + tmp = (tmp - columns) / 10; + rows = rem (tmp, 10); elseif (! (is_scalar (columns) && is_scalar (rows) && is_scalar (index))) error ("subplot: columns, rows, and index have to be scalars"); @@ -115,8 +117,8 @@ set size 1,1 set origin 0,0 - multi_xn = 1; - multi_yn = 1; + multiplot_xn = 1; + multiplot_yn = 1; multiplot_mode = 0; # Someone may have reset it betweeen calls... @@ -125,46 +127,47 @@ automatic_replot = multiplot_save_auto_replot; endif - return; - - endif + else # doing multiplot plots - doagain = 0; + doagain = 0; - if (exist ("multiplot_mode") != 1) - doagain = 1; - elseif (multiplot_mode != 1 || multi_xn != columns || multi_yn != rows) - doagain = 1; - endif + if (exist ("multiplot_mode") != 1) + doagain = 1; + elseif (multiplot_mode != 1 || multiplot_xn != columns + || multiplot_yn != rows) + doagain = 1; + endif - if (doagain) + if (doagain) + + multiplot_mode = 1; + multiplot_xn = columns; + multiplot_yn = rows; + multiplot_xsize = 1.0 ./ columns; + multiplot_ysize = 1.0 ./ rows; - multiplot_mode = 1; - multi_xn = columns; - multi_yn = rows; - multi_xsize = 1.0 ./ columns; - multi_ysize = 1.0 ./ rows; + set multiplot; + + eval (sprintf ("set size %g, %g", multiplot_xsize, multiplot_ysize)); + + endif + +# get the sub plot location - set multiplot; + yp = fix ((index-1)/columns); + xp = index - yp*columns - 1; + multiplot_xi = ++xp; + multiplot_yi = ++yp; - eval (sprintf ("set size %g, %g", multi_xsize, multi_ysize)); +# set the origin + + xo = (xp - 1.0)*multiplot_xsize; + yo = (rows - yp)*multiplot_ysize; + + eval (sprintf ("set origin %g, %g", xo, yo)); endif -# get the sub plot location - - yp = round ((index-1)/columns); - xp = index - yp*columns - 1; - multi_xi = ++xp; - multi_yi = ++yp; - -# set the origin - - xo = (xp - 1.0)*multi_xsize; - yo = (rows - yp)*multi_ysize; - - eval (sprintf ("set origin %g, %g", xo, yo)); - endfunction diff -r 749b8b19733f -r 47bd45a30dda scripts/plot/subwindow.m --- a/scripts/plot/subwindow.m Fri Oct 06 03:10:34 1995 +0000 +++ b/scripts/plot/subwindow.m Fri Oct 06 03:40:11 1995 +0000 @@ -33,8 +33,8 @@ # global variables to keep track of multiplot options global multiplot_mode - global multi_xsize multi_ysize - global multi_xn multi_yn + global multiplot_xsize multiplot_ysize + global multiplot_xn multiplot_yn # check calling argument count @@ -61,12 +61,12 @@ # get the sub plot location - if (xn < 1 || xn > multi_xn || yn < 1 || yn > multi_yn) + if (xn < 1 || xn > multiplot_xn || yn < 1 || yn > multiplot_yn) error ("subwindow: incorrect xn and yn"); endif - xo = (xn - 1.0)*multi_xsize; - yo = (multi_yn - yn)*multi_ysize; + xo = (xn - 1.0)*multiplot_xsize; + yo = (multiplot_yn - yn)*multiplot_ysize; eval (sprintf ("set origin %g, %g", xo, yo));