From: Ethan A M. <merritt@u.washington.edu> - 2004-07-10 19:07:51
|
Hans-Bernhard Broeker <br...@ph...> wrote: > Ethan A Merritt wrote: > > The code in datafile.c and elsewhere (df_readline is not so much > > the culprit here) makes an assumption that it can deduce the style of > > plot based on the number of input columns requested. > > Could you show a concrete example of that? The worst offenders are one level up, in plot[23]d.c in the routines get_data and get_3ddata. Each of these contains a huge switch statement that controls the interpretation of input data columns based on the total number of returned columns. Within each 'case <ncols>:' of the switch statement, the code then tries to run through all possible plot modes that could have generated that number of input columns. I think this is an example of the tail wagging the dog; the main switch statement should rather be over the plot types. The problematic code in df_readline() itself is the bit which decides where to stuff the input values based on the number of requested input columns. It allows for an implicit x coordinate value, but only in the case of 'plot ... using <y> with <something that only takes 2 cols>' /* FIXME EAM - Trap special case of only a single 'using' column. */ /* But really we need to handle general case of implicit column 0 */ if (output == 1) xpos = (axcol == 0) ? df_datum : v[axcol-1]; else xpos = v[axcol]; I even have a real-life example of why this sort of assumption is limiting our options. I would have liked to allow the new 'splot with labels' style to accept the same sort of pm3d coloring options that other plotting styles offer. But I gave up trying to work around the assumptions in the current code that if you have a color value at all, then it must be in the 4th input column. 'splot with labels' needs the 4th specified input column to be the label itself; if there were an additional color value it would be in an optional 5th input column. Yeah, I could hack this to work somehow, but it would be a whole lot easier if the code were organized based on plot style rather than on number of columns. -- Ethan A Merritt Department of Biochemistry & Biomolecular Structure Center University of Washington, Seattle |