From: Ethan A M. <merritt@u.washington.edu> - 2004-06-13 01:22:47
|
On Thursday 10 June 2004 01:50 pm, Hans-Bernhard Broeker wrote: I think the documentation is wrong, and always was wrong, because the behavior it describes has nothing to do with whether the data field contains the "missing" flag or not. It simply describes what happens if the field is *illegal*, which to my mind is a different thing from being "missing". By contrast to version 3.7, the test for missing data in 4.0 actually does something useful. Consider the following example (modified from the docs) set style data lines plot '-' 1 10 2 20 3 * 4 40 5 50 e set datafile missing "*" plot '-' 1 10 2 20 3 * 4 40 5 50 e As the documentation says, the first plot will incorrectly draw a line through (2,3) because the 2nd field is an illegal numerical value. With "*" set as a missing data flag, however, the second plot is drawn correctly. This didn't used to happen. > > I am open to the suggestion that 'plot with lines' in particular > > should be modified so that missing data does not produce > > breaks in the line. > > As long as missing data output DF_UNDEFINED from datafile.c, it must. > Otherwise we'ld be changing the behaviour of piecewise functions > in a seriously broken manner, e.g. > > plot [-10:10] abs(x)>5?abs(x):0/0 w l > > would suddenly have a connection between points (-5,-5) and (5,5), which > we quite definitely don't want. I don't quite follow you here. There was no such connection before the change (in 3.7) and no such connection after the change (in 4.0). If I put in an explicit test for DF_MISSING it won't add a connection then either. I have just modified the code in cvs so that df_readline() passes the DF_MISSING up to the callers. There only three callers (in plot2d.c plot3d.c and fit.c), and all three continue to treat this case as they have been by falling through to the DF_UNDEFINED handler. But if people want 'plot with lines' to draw lines through missing data then I can add a simple test so that the code section in plot2d.c looks like this: case DF_MISSING: if (current_plot->plot_style == LINES) continue; /* Otherwise missing data is treated the same as undefined */ case DF_UNDEFINED: /* bad result from extended using expression */ current_plot->points[i].type = UNDEFINED; i++; continue; That is OK with me, or at least I don't object very strongly. I suppose logically we would test also for LINESPOINTS. I was just trying to point out that this returns us to the case (for "plot with lines") that there is no difference between setting or not setting the missing data flag. Why have a flag if it doesn't make any difference which way it is set? If the user doesn't want to make a distinction between missing and undefined points, then he doesn't have to use the "set datafile missing <char>" option at all. If he wants to indicate missing data then he can set the flag, and the resulting plot will show a break in the line where there is missing data. That seems better to me, but either way it is up to the user to choose which he wants. I hope I have explained my thoughts better this time. -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |