From: Dima K. <gn...@di...> - 2024-01-28 01:11:19
|
Hi. I'm observing a data-parsing problem that I think is a bug... but looking at the code, maybe it isn't? This has been an issue for a long time; it's not something new in 6.0. To reproduce, I have this script: set terminal dumb 80,40 unset grid plot '-' with linespoints 1 - 2 10 3 5 4 13 5 4 6 13 7 7 8 15 e Note the bad-data line "1 -". This produces this plot: 8 +-----------------------------------------------------------------------+ | + + + + + + ** | | '-' ***A*** | | ** | | ** | 7 |-+ *A +-| | ** | | ** | | ** | | ** | 6 |-+ *A* +-| | ** | | ** | | ** | | ** | 5 |-+ A +-| | ** | | ** | | * | | ** | | ** | 4 |-+ *A +-| | ** | | ** | | ** | | ** | 3 |-+ *A +-| | ** | | ** | | ** | | ** | 2 |-+ *A* +-| | ** | | ** | | ** | |** + + + + + + | 1 +-----------------------------------------------------------------------+ 0 1 2 3 4 5 6 7 Note that I would expect an up/down zigzag, which ignores the whole bad-data line. Removing that line produces the expected output: 16 +----------------------------------------------------------------------+ | + + + + + | | '-' ***A*** | | | | | | *| 14 |-+ +*| | * | | * | | A A * | | * ** * | | * * * * * | 12 |-+ * * * * * +-| | * * * * * | | * * * * * | | * * * * * | | * * * * * | | * * * * * | 10 |-+ * * * * * +-| |* * * * * * | | * * * * * * | | * * * * * * | | * * * * * * | | * * * * * * | 8 |-+ * * * * * * +-| | * * * * * * | | * * * * * * | | * * * * A | | * * * * | | * * * * | 6 |-+ * * * * +-| | * * * * | | * * * * | | A * * | | * * | | + + * + + | 4 +----------------------------------------------------------------------+ 2 3 4 5 6 7 8 I can also "fix" it by adding to the script: set datafile missing "-" What should the default behavior be? Should it not be ignoring the bad-data line entirely? The block of code that handles this is here: https://github.com/gnuplot/gnuplot/blob/fbeb88eadedf927a4d778b41dd118e373f33eacb/src/datafile.c#L2380 With this data we have df_column[1].good == DF_BAD. The code checks for DF_MISSING and DF_UNDEFINED, but not DF_BAD. We end up exiting the loop here: https://github.com/gnuplot/gnuplot/blob/fbeb88eadedf927a4d778b41dd118e373f33eacb/src/datafile.c#L2425 which leaves output==1. And then we set df_no_use_specs = output = 1 a bit later: https://github.com/gnuplot/gnuplot/blob/fbeb88eadedf927a4d778b41dd118e373f33eacb/src/datafile.c#L2458 So the first row of data has one valid column, and we then expect exactly one valid column from every subsequent row of data as well. Checked here: https://github.com/gnuplot/gnuplot/blob/fbeb88eadedf927a4d778b41dd118e373f33eacb/src/datafile.c#L742 Is this what we want? Thanks much |