help-octave
[Top][All Lists]
Advanced

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

Re: Bug in script for plotting


From: Ben Abbott
Subject: Re: Bug in script for plotting
Date: Fri, 08 Feb 2013 14:41:18 -0500

On Feb 8, 2013, at 7:41 AM, c. wrote:

> 
> On 8 Feb 2013, at 01:59, Ben Abbott <address@hidden> wrote:
> 
>> On Feb 7, 2013, at 5:28 PM, stn wrote:
>> 
>>> Hi,
>>> 
>>> this is kind of irritating. It has also probably been discussed before.
>>> 
>>> 
>>> The plot-command works fine, the plot appears as expected, but on the 
>>> terminal there is a message
>>> 
>>> gnuplot> nset obj 1;
>>>        ^
>>>        line 0: invalid command
>>> 
>>> 
>>> After lots of googling and some grepping I found this line in 
>>> /usr/local/share/octave/3.6.3/m/plot/private/__go_draw_axes__.m
>>> 
>>> Only there it says "unset obj". More specifically it says "fputs 
>>> (plot_stream, "unset obj 1; \\\n");"
>>> 
>>> The problem can be solved by replacing every occurence of "unset obj" in 
>>> the script with " unset obj".
>>> 
>>> It would appear that the function fputs() does not work correctly and 
>>> truncates the first character of this string. The solution mentioned above 
>>> simply adds a space-character, that is then truncated.
>>> 
>>> I would like to suggest checking the matter.
>>> 
>>> Best regards, stn
>> 
>> I've seen this mentioned before, but I do not get this error.  For example, 
>> each of the following work for me.
>> 
>>      plot (rand (3))
>>      surf (peaks ())
>>      contour (peaks ())
>> 
>> I'm using gnuplot 4.6 patchlevel 1 
>> 
>> Can you tell us what version of gnuplot you are using (just in case that is 
>> involved in some way).  Also, can you provide a short script that produces 
>> the error for you so that we may try to duplicate it?
>> 
>> Ben
> 
> Ben,
> 
> I run the development Octave version, I have gnuplot 4.6 patch level 1 
> (installed via macports) and XQuartz 2.7.4 on OSX 10.8.2.
> I can consistently reproduce the same issue reported by stn as follows:
> 
> 1) stop XQuartz
> 2) plot (randn (3))
> 
> the issue can be simply worked around by adding a space in front of all 
> instances of "unset obj 1" as stn suggested, it seems the first character in 
> sent to the pipe is getting lost somehow …
> 
> c.

Carlo,

I produced a plot-stream by ...

        plot (rand (3))
        drawnow ("aqua", "/dev/null", false, "debug.gp")

The "unset obj 1" command comes at the end of binary data record, whose ending 
looks like below in vi.

@@@@@@@@@@@@ @ @"@"@address@hidden@unset obj 1;

I'm thinking the problem may be with the binary record (not with the unset 
command).

Perhaps some padding should be added after each binary record?  This may just 
break things (works for me), but does the diff below eliminate the problem for 
you?

diff --git a/scripts/plot/private/__go_draw_axes__.m 
b/scripts/plot/private/__go_draw_axes__.m
--- a/scripts/plot/private/__go_draw_axes__.m
+++ b/scripts/plot/private/__go_draw_axes__.m
@@ -2027,6 +2027,7 @@
       endif
     endif
   endif
+  fprintf (plot_stream, "\n # pad the plotstream\n")
 
 endfunction


Ben






reply via email to

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