|
From: Daniel J S. <dan...@ie...> - 2004-03-04 17:39:55
|
Hans-Bernhard Broeker wrote:
>On Wed, 3 Mar 2004, Daniel J Sebald wrote:
>
>
>>Oh yeah, I forgot about "matrix". The issue there is that "matrix" is
>>designed for 3d data, i.e., splot. (List members, if anything I say
>>here is incorrect, please correct me.)
>>
>>
>
>I was going to about 'matrix', but you seemed to be progressing so nicely,
>I though I'ld let you you find that one yourself ;->
>
>
>
>>There is a routine in "datafile.c" called df_3dmatrix. I think it only
>>get's called from "plot3d.c".
>>
>>
>
>Don't just think, check it. Tools like "cscope" will let you answer such
>queries almost in an instant:
>
>gnuplot/src> cscope -L0 df_3dmatrix
>datafile.h <global> 100 int df_3dmatrix __PROTO((struct surface_points *, int ));
>datafile.c df_3dmatrix 1268 df_3dmatrix(this_plot, need_palette)
>plot3d.c get_3ddata 652 xdatum = df_3dmatrix(this_plot, NEED_PALETTE(this_plot));
>
>You can even let it show you only the calls to a function:
>
>gnuplot/src> cscope -L3 df_3dmatrix
>plot3d.c get_3ddata 652 xdatum = df_3dmatrix(this_plot, NEED_PALETTE(this_plot));
>
I must learn how to use this cscope. (I've bookmarked the info page...
hey, why the water jostling around in the magnifying glass guy's head?
Is he/she/it supposed to be half magnifying glass, half periscope,
i.e., sea scope?)
>>not the mode is "splot" or "plot". In other words, if I'm not mistaken,
>>Gnuplot should not allow "matrix" to be used in "plot" mode.
>>
>>
>
>The current official version probably shouldn't, right. So let's try...
>
>gnuplot> p 'using.dat' matrix u ($0):2:3 w e
>
>No error, no warning, and a rather stupid plot. How's that for a rather
>surprising undocumented feature?
>
Yes... As a temporary fix for 4.0, the following placed near the start
of the eval_plots() routine inside plot2d.c will rule out using 'matrix'
option with 'splot'. (Patch attached.)
/* Temporary hack to rule out 'matrix' for 2d plots. 'matrix' is
currently
tested for inside df_open() which doesn't know the option currently
can't be used with 'plot'. This should be cleaned up post 4.0
and this
chunk of code tossed out. */
while (!END_OF_COMMAND) {
if (almost_equals(c_token, "mat$rix"))
int_error(c_token, "option 'matrix' not supported for 2d plots");
c_token++;
}
c_token = begin_token;
/* ** First Pass: Read through data files ***
>>Actually, in the image patch, I modified things so that a mode variable
>>is passed into that routine so it is possible to identify whether
>>"splot" or "plot" was issued. I probably needed that information for
>>something else, but it could be used to rule out "matrix" when issued
>>with "plot".
>>
>>
>
>But it should only be ruled out if that was not a 'plot with pixels',
>right?
>
Correct.
>>in previous discussions, that 2d and 3d formats have diverged in some
>>ways.
>>
>>
>
>I suspect they have never started off a common ground in the first place.
>After looking at all the code for prolonged times, you get the impression
>3D must have been grafted onto an existing 2D-only plotting program as an
>afterthought.
>
Yes, that is my impression as well.
>>I think the "datafile.c" and related routines could be cleaned up
>>a great deal, focusing more on just getting data from a file into
>>Gnuplot and not so much on what the eventually plotting mode will look like.
>>
>>
>
>Agreed. After 4.0 is out, we could split datafile.c into two: datafile.c
>and "using.c". The latter would be in charge of all the translation from
>data records into gnuplot "points", i.e. treat options 'using', 'every',
>'index' and 'smooth' (which really should be renamed to 'filter' some
>time).
>
That should be good.
>>Do developers here agree that, for large files, binary data in "plot"
>>mode is preferable to ascii matrix?
>>
>>
>
>Preferrable: yes. But not so much so that it would be a strong argument
>against allowing 'matrix' at least in those 2D plots that really are 3D
>(i.e. "plot with image").
>
>I think we actually should allow 'matrix' for such plots. It's about
>equally sensible as allowing binary files for 2D plots.'
>
Sure. I think 'matrix' should be valid whenever appropriate. If
someone has a small set of data, fine. And if they have a large set of
data, fine too. But I think it is just a better habit to work with
compact data and not 20 M ASCII files.
Dan
|