Re: Trouble with contours and binary arrays

Ethan A Merritt <[email protected]> Tue, 17 May 2022 14:47:37 -0700
Newsgroups gmane.comp.graphics.gnuplot.devel
Organization University of Washington
Message-ID <3233522.KgjxqYA5nG@stonelion>
On Monday, 16 May 2022 15:39:25 PDT Dima Kogμan wrote:
> Hi. I'm having trouble with contoured plots, and I'm guessing there's at
> least one gnuplot bug here. Can I please get some pointers?
> 
> I make a binary data file. This is an regular matrix of 32-bit floats:
> 
>   perl -E 'for $i (0..99) { for $j (0..89) { $f=sin($i/30.)+cos($j/5.); print pack("f",$f); }}' > /tmp/sincos.float32
> 
> For convenience I'm attaching this data.
> 
> I can successfully plot a heatmap:
> 
>   splot "sincos.float32" binary array=(90,100) format="%float" with image


[snip]


> Second issue. I'd like to plot boxed contour labels. This works OK with
> ASCII matrix data, but with binary data it doesn't work. I run this
> gunplot script:
> 
>   set view map
>   set contour base
>   splot "sincos.float32" binary array=(90,100) format="%float" with labels boxed nosurface
> 
> And I see this:
> 
>   "cmd" line 3: warning: Couldn't slurp 72000 bytes (return was 36000)
> 
>   splot "sincos.float32" binary array=(90,100) format="%float" with labels boxed nosurface
>                                                                                           ^
>   "cmd" line 3: All points x value undefined
> 
> For whatever reason it's trying to read 8 bytes per point instead of 4.
> Some brief debugging tells me it thinks there're two values to read from
> each point, when in reality there's just one.
> 
> Thoughts?


This second issue is a simple bug.  The default number of input columns is taken as 2
(z value + label text) but for contour labels there is no separate second input column.
You can work around this by giving an explicit "using <foo>" in the splot command:

   splot "sincos.float32" binary array=(90,100) format="%float" using ("foo") with labels boxed nosurface

That gets you auto-generated labels that correspond to the input binary z values.
As before, however, those values are taken as-is.
You still cannot modify the z values via a using specifier.

	Ethan

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta