|
From: Ethan M. <merritt@u.washington.edu> - 2011-09-30 22:10:24
|
On Friday, September 30, 2011 02:28:09 pm pl...@pi... wrote: > On 09/30/11 23:06, Ethan Merritt wrote: > > On Friday, September 30, 2011 12:20:57 pm pl...@pi... wrote: > >> Hi, > >> > >> I am calling a simple function max() to detect the two largest peaks in > >> the data. > >> > >> > >> #function to do sample/hold > >> max(x,y)=(ymax<y) ? ( xmax=x, ymax=y) :ymax ; > >> > >> # dummy plot to scan data for biggest peak > >> set term unknown > >> plot ymax=xmax=0, datafile using 1:( max(($1),($2)) ); > >> pk0=xmax; ymax=xmax=0; > >> plot [pk0+100:] datafile using 1:( max(($1),($2)) ); > >> pk1=xmax; > > > >> It's hitting the first one both times. > > > >> Now unless I'm getting sleepy, this seems to show that the second call > >> to plot with a specified limited range is still going through the > >> motions. and evaluating the using clause for all data points in the > >> file. Thus all the mechanics are still being gone through only to have > >> null output created. > > > > How would it know if $1 and/or $2 are out of range without > > evaluating them first? > > > clearly it has to read the data lines but what needs evaluating, then > range is a given constant. > > It seems it is evaluation the using clause , yet this is not what the > range applies to , it applies to $1. > > Am I mistaken? You are mistaken. The xrange applies to whatever expression is evaluated in the first field of the 'using' clause. Another way of stating this is that xrange applies (logically enough) to the range of the x axis of the plot. It does not depend on the numerical contents of any data file. Consider the following plot: plot '-' using ($1/10.):($2/10.) 10 50 20 50 30 40 40 60 50 40 60 60 70 0 e This generates a plot where the x axis runs from 1->7 and the y axis runs from 0->5. If you first do set xrange [0:9] this will actually _expand_ the xrange. Certainly it will not reject all the data points. -- Ethan A Merritt Biomolecular Structure Center, K-428 Health Sciences Bldg University of Washington, Seattle 98195-7742 |