text (...) function behaviour for large numbers? Bug?

David Bateman adb014 at gmail.com
Thu Dec 6 15:06:24 CST 2007


John W. Eaton wrote:
> On  5-Dec-2007, Matthias Brennwald wrote:
> 
> | I tried to use the text(...) command for text labels in a plot with
> | large numbers. For y coordinates larger than 2E9, the text is not placed
> | correctly. Try this to see what I mean:
> | 
> | --------------
> | plot(rand(1,10)*1e10)
> | axis ([1 10 1e8 1e10]);
> | text(2,1e9,'1E9')
> | text(3,2e9,'2E9')
> | text(4,3e9,'3E9')
> | text(5,4e9,'4E9')
> | text(6,5e9,'5E9')
> | --------------
> | 
> | Matthias
> | 
> | 
> | (This message was copied from the help-octave list. David Bateman  
> | already gave some information on the problem there)
> 
> Version of Octave?
> 
> Version of gnuplot?
> 
> I'd be happy to have a patch that fixes this problem and doesn't break
> other cases that have been discussed in the past:
> 
>   http://www.nabble.com/plotting-hickups-tf4472722.html#a12764780
> 
> But in any case, I suspect we will have these kinds of problems until
> gnuplot is fixed, or we use something else for rendering graphics that
> doesn't require using text formats for sending data for things like
> text label locations.
> 
> jwe


John,

I don't think there is a complete solution that will fix everything
without breaking somewhere unless we can pipe the data to gnuplot in
binary format.. Barring that anything will be a kludge. Half the problem
for this case is in gnuplot, as octave gives the correct output for the
above, but it seems that gnuplot is treating it internally as a signed
integer and is saturating the values larger than 2^31 - 1 to 2^31 - 1...
 So you'd have to use a floating point format to force gnuplot to get
the case above correct and then we'd fallback into the same issue as in
the above message.

So the only real fixes for this is in gnuplot itself..

1) Gnuplot should accept things like

   set label "label" at 2,5000000000

  correctly within 32-bit signed integer saturation

2) We should be able to pipe binary data to gnuplot in the same way as
we can for the colormaps..

D.


More information about the Bug-octave mailing list