|
From: Ethan A M. <me...@uw...> - 2022-05-17 21:48:06
|
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
|