|
From: Daniel J S. <dan...@ie...> - 2008-01-31 08:11:29
|
Ethan Merritt wrote:
> On Wednesday 30 January 2008 12:42, Ethan Merritt wrote:
>
>>I help is needed from someone more familiar with the binary data modes.
>>Anyone care to take over this bug report?
>
>
>
> The following one-liner makes your test case work.
>
> However, I am *not* applying this to CVS because I just don't understand
> the code well enough. The binary read code at this point is not parallel
> to the ascii input code, which simply does ++df_datum as it goes.
> Why is this different? Is it correct? Will it break other things?
> I don't know.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> --- gnuplot/src/datafile.c 2008-01-25 12:59:41.000000000 -0800
> +++ gnuplot-cvs/src/datafile.c 2008-01-30 23:01:30.000000000 -0800
> @@ -4937,7 +4937,7 @@
> }
> }
> } else { /* Not matrix file, general binray. */
> - df_datum = point_count;
> + df_datum = point_count+1; /* EAM DEBUG */
> if (i != df_no_bin_cols) {
> if (feof(data_fp)) {
> if (i != 0)
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>
>>On Wednesday 30 January 2008 12:15, Ralf Juengling wrote:
>>
>>>Here you go. The binary data is in intel pentium endianess
>>>(whatever that is).
>>
>>Thanks. So far as I can tell from a quick test, the problem is
>>not specific to histograms. Any other plot type also gets incorrect
>>x coordinates when using the binary read command on that data file.
>>If I dump the contents after reading them in, I get this:
>>
>>gnuplot> set style data linespoints
>>gnuplot> plot "histdata.bin" binary array=1:8 format="%int" using 1
>>gnuplot> set table
>>gnuplot> replot
The array=1:8 specification indicates that there are two single dimensional arrays of data, one 1 element long, another 8 elements long. However, that doesn't seem to match what the user is intending if there are only 7 data points. (There should be nine.) Perhaps the user just wants array=7.
>>
>># Curve 0 of 1, 7 points
>># Curve title: ""histdata.bin" binary array=1:8 format="%int" using 1"
>># x y type
>> 0 102 i
The above would be the first "line" of data.
>> 0 42 i
>> 1 38 i
>> 2 28 i
>> 3 26 i
>> 4 108 i
>> 5 156 i
The rest constitutes the second "line" of data, even though there isn't enough to fill out eight elements.
Both of the above start at zero. If you want the inherent x value assigned to begin at 1 with the above patch, that's fine. (Is that what the ASCII data default is? Then matching the two would be good.)
The thing that is a bit of a problem is what the table displays. Curve 0 of 1 should maybe be curve 1 of 1, but more importantly, one might expect it to be Curve 1 of 2 and Curve 2 of 2 if the user specifies array=L1:L2, where L means "length".
However, this trait isn't unique to binary data. Try the following:
Terminal type set to 'x11'
gnuplot> set table
gnuplot> plot '-' with lines
input data ('e' ends) > 1
input data ('e' ends) > 2
input data ('e' ends) > 3
input data ('e' ends) > 4
input data ('e' ends) >
input data ('e' ends) >
input data ('e' ends) > 5
input data ('e' ends) > 6
input data ('e' ends) > 7
input data ('e' ends) > 8
input data ('e' ends) > e
# Curve 0 of 1, 9 points
# Curve title: "'-'"
# x y type
0 1 i
1 2 i
2 3 i
3 4 i
0 0 u
0 5 i
1 6 i
2 7 i
3 8 i
gnuplot>
The x-values assigned begin at 0. There is an extra "undefined" in the middle, which doesn't happen for binary data. Note that the comment says curve 0 of 1 (perhaps that is correct, i.e., multiple scan lines but still a single curve). But 9 points instead of 8?
Dan
|