|
From: sfeam <me...@uw...> - 2019-01-31 00:12:50
|
On Wednesday, 30 January 2019 10:01:00 Dima Kogan wrote:
> Hi. I'm seeing a strange behavior. I THINK it's a bug, but maybe not?
> Note that the below is about "with image": we have z vs. (x,y) and NOT
> "with rgbimage" where we have (r,g,b) vs (x,y).
>
> I can plot a simple 3x3 grid of data:
>
> set view map
> splot '-' matrix notitle with image
> 0.0 1.0 4.0
> 1.0 2.0 5.0
> 4.0 5.0 8.0
>
> e
>
> This works, and uses the default implicit x and y ranges: integers
> starting at 0. I can adjust this with "using". For instance I can
> linearly scale the x axis like this:
>
> set view map
> splot '-' matrix using ($1*10):2:3 notitle with image
> 0.0 1.0 4.0
> 1.0 2.0 5.0
> 4.0 5.0 8.0
>
> e
>
> This works too. I can also feed in binary data instead of ascii. The
> example without "using" looks like this:
>
> set view map
> splot '-' binary array=(3,3) format="%double" notitle with image
> [ binary data ]
>
> (I'm omitting the actual data here; the functional version including the
> data is in the attachment). This works too, and produces the same plot,
> as expected. However, if I try to scale the x axis with the "using"
> clause as before, it does NOT work:
>
> set view map
> splot '-' binary array=(3,3) format="%double" using ($1*10):2:3 notitle with image
> [ binary data ]
>
> (again, the full script is attached). In the binary-no-using case I see
> gnuplot try to read 72 bytes of binary data. This makes sense since 72 =
> 3*3*sizeof(double). In the binary-using case, however, I see gnuplot try
> to read 216 bytes intead. this is 72*3. But there aren't that many bytes
> available, so it barfs.
>
> As I user I was not expecting this, especially since the other 3 cases
> work. Thoughts?
My thoughts are that it's worse than you describe.
A related limitation is that it is not possible to combine 'using' with
reading an image data from a binary file for any purpose other than
"with image". Not for generic binary files and not for specific known file types.
For example you might want to plot a histogram of intensity values in the
blue component of an RGB image file. Logically this would mean extracting
the values in "column 5", assuming a mapping to x:y:R:G:B as documented.
The logical gnuplot command would be something like
plot 'foo.jpg' binary filetype=jpeg using 5 smooth freq with boxes
Nothing of the sort works.
I see no consistency in the mapping of binary data to "columns".
This has annoyed me for a long time but the problem seems so intrinsic
to the way the program currently works that I don't see a way to change it.
Ethan
|