octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speeding Up gnuplot Interface with Binary Data


From: Daniel J Sebald
Subject: Re: Speeding Up gnuplot Interface with Binary Data
Date: Tue, 14 Oct 2008 23:22:35 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Ben Abbott wrote:

I have problems with 3d plotting with the current hg octave.
E.g. sombrero dumps bunch of control characters to the terminal:


I see the same thing for gnuplot 4.2.3.

I came across that too this afternoon.  Here is a patch (meant for hg-head) for 
which I've tested plot, mesh, image and patch.

Dan
--- __go_draw_axes__.m.orig     2008-10-14 23:08:21.765239774 -0500
+++ __go_draw_axes__.m  2008-10-14 23:15:26.536109703 -0500
@@ -382,7 +382,7 @@
            tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel"));
            titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
          endif
-         usingclause{data_idx} = "";
+         usingclause{data_idx} = ["record=" num2str(rows(obj.xdata(:)))];
          errbars = "";
          if (nd == 3)
            xdat = obj.xdata(:);
@@ -393,7 +393,7 @@
              zdat = zeros (size (xdat));
            endif
            data{data_idx} = [xdat, ydat, zdat]';
-           usingclause{data_idx} = "using ($1):($2):($3)";
+           usingclause{data_idx} = ["record=" num2str(rows(xdat)) " using 
($1):($2):($3)"];
            ## fputs (plot_stream, "set parametric;\n");
          else
            xdat = obj.xdata(:);
@@ -440,11 +440,11 @@
                  xhi = xdat+xudat;
                endif
                data{data_idx} = [xdat, ydat, xlo, xhi, ylo, yhi]';
-               usingclause{data_idx} = "using ($1):($2):($3):($4):($5):($6)";
+               usingclause{data_idx} = ["record=" num2str(rows(xdat)) " using 
($1):($2):($3):($4):($5):($6)"];
                errbars = "xyerrorbars";
              else
                data{data_idx} = [xdat, ydat, ylo, yhi]';
-               usingclause{data_idx} = "using ($1):($2):($3):($4)";
+               usingclause{data_idx} = ["record=" num2str(rows(xdat)) " using 
($1):($2):($3):($4)"];
                errbars = "yerrorbars";
              endif
            elseif (xerr)
@@ -459,12 +459,12 @@
                xhi = xdat+xudat;
              endif
              data{data_idx} = [xdat, ydat, xlo, xhi]';
-             usingclause{data_idx} = "using ($1):($2):($3):($4)";
+             usingclause{data_idx} = ["record=" num2str(rows(xdat)) " using 
($1):($2):($3):($4)"];
              errbars = "xerrorbars";
            else
              data{data_idx} = [xdat, ydat]';
-             usingclause{data_idx} = sprintf ("using ($1):($2) axes %s%s",
-                                             xaxisloc_using, yaxisloc_using);
+             usingclause{data_idx} = sprintf ("record=%d using ($1):($2) axes 
%s%s",
+                                             rows(xdat), xaxisloc_using, 
yaxisloc_using);
            endif
          endif
 
@@ -520,7 +520,6 @@
                 tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, 
obj, "keylabel"));
                 titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
               endif
-              usingclause{data_idx} = "";
                if (isfield (obj, "facecolor"))
                 if ((strncmp (obj.facecolor, "flat", 4)
                     || strncmp (obj.facecolor, "interp", 6))
@@ -573,7 +572,7 @@
               withclause{data_idx} = sprintf ("with filledcurve %s",
                                               colorspec);
               data{data_idx} = [xcol, ycol]';
-              usingclause{data_idx} = "using ($1):($2)";
+              usingclause{data_idx} = ["record=" num2str(rows(xcol)) " using 
($1):($2)"];
             endif
           endif
 
@@ -585,7 +584,7 @@
              parametric(data_idx) = false;
             have_cdata(data_idx) = false;
              titlespec{data_idx} = "title \"\"";
-            usingclause{data_idx} = "";
+            usingclause{data_idx} = ["record=" num2str(rows(obj.xdata(:)))];
 
             if (isfield (obj, "markersize"))
               mdat = obj.markersize / 6;
@@ -739,14 +738,14 @@
               else
                 data{data_idx} = [xcol, ycol, zcol]';
               endif
-              usingclause{data_idx} = "using ($1):($2):($3)";
+              usingclause{data_idx} = ["record=" 
num2str(columns(data{data_idx})) " using ($1):($2):($3)"];
             else
               if (! isnan (xcol) && ! isnan (ycol))
                 data{data_idx} = [[xcol; xcol(1)], [ycol; ycol(1)]]';
               else
                 data{data_idx} = [xcol, ycol]';
               endif
-              usingclause{data_idx} = "using ($1):($2)";
+              usingclause{data_idx} = ["record=" 
num2str(columns(data{data_idx})) " using ($1):($2)"];
             endif
           endif
         endfor
@@ -767,7 +766,6 @@
              tmp = undo_string_escapes (__maybe_munge_text__ (enhanced, obj, 
"keylabel"));
              titlespec{data_idx} = cstrcat ("title \"", tmp, "\"");
            endif
-           usingclause{data_idx} = "";
            withclause{data_idx} = sprintf ("with pm3d linestyle %d",
                                            data_idx);
 
@@ -820,7 +818,7 @@
              ## No interpolation of facecolors.
              interp_str = "";
            endif
-           usingclause{data_idx} = "using ($1):($2):($3):($4)";
+           usingclause{data_idx} = sprintf ("record=%dx%d using 
($1):($2):($3):($4)", xlen, ylen);
 
             flat_interp_face = (strncmp (obj.facecolor, "flat", 4)
                                || strncmp (obj.facecolor, "interp", 6));
@@ -1144,11 +1142,11 @@
          fprintf (plot_stream, "set view %.15g, %.15g;\n", rot_x, rot_z);
        endif
       endif
-      fprintf (plot_stream, "%s \"-\" binary record=%d format='%%float64' %s 
%s %s \\\n", plot_cmd,
-              columns(data{1}), usingclause{1}, titlespec{1}, withclause{1});
+      fprintf (plot_stream, "%s \"-\" binary format='%%float64' %s %s %s 
\\\n", plot_cmd,
+              usingclause{1}, titlespec{1}, withclause{1});
       for i = 2:data_idx
-       fprintf (plot_stream, ", \"-\" binary record=%d format='%%float64' %s 
%s %s \\\n",
-                columns(data{i}), usingclause{i}, titlespec{i}, withclause{i});
+       fprintf (plot_stream, ", \"-\" binary format='%%float64' %s %s %s \\\n",
+                usingclause{i}, titlespec{i}, withclause{i});
       endfor
       fputs (plot_stream, ";\n");
       for i = 1:data_idx

reply via email to

[Prev in Thread] Current Thread [Next in Thread]