Trouble with contours and binary arrays

Dima Kogan <[email protected]> Mon, 16 May 2022 15:39:25 -0700
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
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

I can also transform the data and plot:

  splot "sincos.float32" binary array=(90,100) format="%float" using ($1+100) with image

This all works. Without the transform, I can also plot contours:

  set view map
  set contour base
  splot "sincos.float32" binary array=(90,100) format="%float" with lines nosurface

But if I add the transform, it is ignored by the contours. THIS doesn't
work:

  set view map
  set contour base
  splot "sincos.float32" binary array=(90,100) format="%float" using ($1+100) with lines nosurface

There's no error message. It just produces the untransformed data.



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?

Thanks!

_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
sincos.float32 (application/octet-stream, 35.2 KB) - not displayed