octave-maintainers
[Top][All Lists]
Advanced

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

Re: First datapoint is discarded on second call to plot


From: John W. Eaton
Subject: Re: First datapoint is discarded on second call to plot
Date: Wed, 7 Mar 2007 12:49:02 -0500

On  7-Mar-2007, Daniel J Sebald wrote:

| Bug fix attached...
| 
| 
| Søren Hauberg wrote:
| > Hi,
| >   Running a recent checkout from cvs I got a weird behaviour when I plot 
| > to curves. This code
| > 
| >   figure
| >   hold on
| >     f = sin(0:0.1:2*pi);
| >     plot(f)
| >     plot(1+f)
| >   hold off
| > 
| > produces to sine curves but the second one (the upper one) is missing 
| > the first data point.
| > 
| > Søren
| > 
| 
| 
| -- 
| 
| Dan Sebald
| phone: 608 256 7718
| email: daniel DOT sebald AT ieee DOT org
| URL: http://webpages DOT charter DOT net/dsebald/
| --- /usr/local/share/octave/2.9.9+/m/plot/__uiobject_draw_axes__.m    
2007-03-04 16:14:47.000000000 -0600
| +++ ./__uiobject_draw_axes__.m        2007-03-07 11:37:15.060501272 -0600
| @@ -670,6 +670,8 @@
|                filespec{i}, usingclause{i}, titlespec{i}, withclause{i});
|        endfor
|        fputs (plot_stream, ";\n");
| +      fflush (plot_stream);
| +
|        for i = 1:data_idx
|       if (strcmp (filespec{i}, "-"))
|         if (nd == 2)
| @@ -688,15 +690,12 @@
|             endfor
|           endif
|         endif
| -       fputs (plot_stream, "e");
| +       fputs (plot_stream, "e\n");
|         fflush (plot_stream);
|       endif
|        endfor
|      endif
|  
| -    fputs (plot_stream, "\n");
| -    fflush (plot_stream);
| -
|    else
|      print_usage ();
|    endif    

I made the following change instead.  I don't see why we should need
to flush the plot stream more than once.

Thanks,

jwe


Index: scripts/plot/__uiobject_draw_axes__.m
===================================================================
RCS file: /cvs/octave/scripts/plot/__uiobject_draw_axes__.m,v
retrieving revision 1.21
diff -u -u -r1.21 __uiobject_draw_axes__.m
--- scripts/plot/__uiobject_draw_axes__.m       28 Feb 2007 23:15:23 -0000      
1.21
+++ scripts/plot/__uiobject_draw_axes__.m       7 Mar 2007 17:47:01 -0000
@@ -642,7 +642,6 @@
     endif
 
     fputs (plot_stream, "set style data lines;\n");
-    fflush (plot_stream);
 
     if (! use_gnuplot_for_images)
       for i = 1:ximg_data_idx
@@ -688,13 +687,11 @@
              endfor
            endif
          endif
-         fputs (plot_stream, "e");
-         fflush (plot_stream);
+         fputs (plot_stream, "e\n");
        endif
       endfor
     endif
 
-    fputs (plot_stream, "\n");
     fflush (plot_stream);
 
   else

reply via email to

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