|
From: Chris K <gnu...@li...> - 2006-04-02 21:25:04
|
Daniel J Sebald wrote: > Chris K wrote: > >> outd.data is exactly 10 floats long (40 bytes) >> >> cat test-2.gp outd.data out.data | gnuplot WORKS >> cat test-3.gp outd.data out.data | gnuplot WORKS >> cat test-4.gp outd.data out.data | gnuplot FAILS >> cat test-4.gp outd.data out.data outd.data | gnuplot WORKS > > If you mean that it plots, then yes "WORKS" is correct. However, I > think this isn't working the manner you intend. That's what I meant. > > It's subtle because of the fact the data within the file looks to be a > simple linear or affine relationship. Thus, the shape of the curve when > gnuplot does or doesn't generate the index data is about the same. Read > on... Yup, just 0..9 > >>> This works: >>> >>> set title "test-2.gp" >>> plot "-" binary record=10 using 0:1 with linespoints,\ >>> "-" binary record=10 using 0:($1)**2 with linespoints > > It specifies record of 10 and since "0" is a special qualifier in > gnuplot meaning to generate the index data 10x1=10 floats for the first > line and 10*1=10 floats for the second line. No problem; a plot with > red and green lines each containing 10 points. (I'll send you the PNGs > in a separate email.) > My plots look like your PNGs > There may be a bug here however. I notice that with "0" the index > starts at "-1" on the plot. That doesn't seem a reasonable place to > start. It should be either "0" or "1". I will check the documentation > to see if the start value is specified and will fix it accordingly. Yeah, I did not pay attention to the (-1) starting x-scale. That is even weirder than I thought. Definitely a bug from my POV. >>> >>> This works: >>> >>> set title "test-3.gp" >>> plot "-" binary record=10 using 0:1 with linespoints,\ >>> "-" binary record=5x2 using 1:($2)**2 with linespoints > > Again, there is a "0" on the first line so that is 10x1=10 floats. But > now the second line is saying that the record inside the binary file is > 5 by 2 or five pairs (or five 2 tuples) and the using syntax says to use > the first coordinate of the pair and the second coordinate of that > pair. The "record" and "using" do no conflict, but the specification is > that there are only 5 points. > > So if you look at the graphs you should see there are only 5 points for > "test-3.png". As I said before, because of the linear nature of the > data, you may have seen the two and thought that "test-2" and "test-3" > plotted the same but in fact they are different. I knew they were different. I was mainly worried about crashing. > >>> >>> This fails, saying "line 0: warning: Skipping data file with no valid >>> points" >>> >>> set title "test-4.gp" >>> plot "-" binary record=5x2 using 1:2 with linespoints,\ >>> "-" binary record=5x2 using 1:($2)**2 with linespoints >>> >>> The use of 5x2 instead of 10 in the first plot triggers the error. I >>> am going >>> to hypothesize that the first use of "record=5x2" causes it to read >>> an amount of >>> data greater than "record=10". > > You may be correct. But I don't see why if fails. This could be a > strange "loose end" kind of bug (an unaccounted for boundary value or > something) because the "record" and "using" make sense on the plot. The > data in the file is 0 1 2 3 4 5 6 7 8 9 and both the red and green plots > are obviously treating the data as > > (0,1) > (2,3) > (4,5) > (6,7) > (8,9) > > in "test-4.png". > > OK, so a couple strange things there, using "0" starting at -1 and a > complaint about running out of data when there really shouldn't be. Let > me work on this... > > Dan > And since "cat test-4.gp outd.data out.data outd.data | gnuplot WORKS" it *seems* to be (a) reading exactly twice as much data for the first 5x2 record as it should and then (b) is happy with a normal amount of data in the second 5x2 record. This behavior is strange enough that I can't really understand how to work around it. And I looked at datafile.c and the parsing is very powerful and very hairy. Trying to think in "clever c" and "clever haskell" in the same day is giving me mental whiplash. -- Chris |