|
From: Daniel H. <dan...@ya...> - 2008-01-22 13:54:03
|
dear developers,=0A=0AI am nost sure if this is the developers list, but I = didn't find another link to it.=0A=0AIf it is see below my questions if not= , please forward me to the "right" adress.=0A=0AThanks.=0A=0A--------------= -----------------------=0AProblem:=0AI would like to add some functions to = the CVS version of gnuplot.=0AThese functions include:=0Amin()=0Amax()=0Ast= d()=0Amean()=0Aetc.=0A=0Aso for example it would be possible to run:=0A=0Ap= lot "summary_01.ascii" using 1:(0.90*min($2,$3)) with lines lt 1 lc rgb = "#0000ff" lw 2=0A=0AHowever for min and max this is doable with two argumen= ts only even if it is awesome if I have more then two values=0Ato build the= "minimum":=0A .... using 1:(0.90*min($2,min($3,min($4,$5)))) ...=0AFor me= an and std this is not doable.=0A=0AOne option would be to add a number-of-= arguments arguments: such as=0Amin(nargs,$2,$3,$4). However this looks ugly= for me.=0A=0AIs there a way, that the gnuplot "parser" detects the number = of arguments on another way and I have access to it=0Acounting the number a= rguments so I could simply live with a=0A=0Amin($2,$3,$3) for example.=0A= =0AMaybe there is already another solution inside gnuplot for these kinds o= f "problem".=0A=0APlease let me know. =0A=0AThanks, daniel heiserer=0A=0A= =0A=0A=0A Jetzt Mails schnell in einem Vorschaufenster =FCberfliegen. = Dies und viel mehr bietet das neue Yahoo! Mail - www.yahoo.de/mail |
|
From: Ethan M. <merritt@u.washington.edu> - 2008-01-22 22:21:10
|
On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: > dear developers, > > I am nost sure if this is the developers list, but I didn't find another link to it. The is the developer list, yes. Welcome. > Problem: > I would like to add some functions to the CVS version of gnuplot. > These functions include: > min() > max() > std() > mean() > etc. > > so for example it would be possible to run: > > plot "summary_01.ascii" using 1:(0.90*min($2,$3)) with lines lt 1 lc rgb "#0000ff" lw 2 Could you explain why you need to have these as built-in functions? What is wrong with just defining them yourself: min(A,B) = A < B ? A : B You can put that definition in your customization file ~/.gnuplot if you always like to have it. > Is there a way, that the gnuplot "parser" detects the number of arguments > on another way and I have access to it It knows internally, yes. You could look at the implementation of sprintf() for example. That takes an arbitrary number of arguments. The internal name for this function is f_sprintf(). You can find the source code in internal.c -- Ethan A Merritt |
|
From: Mojca M. <moj...@gm...> - 2008-01-22 22:30:47
|
On Jan 22, 2008 11:20 PM, Ethan Merritt wrote: > On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: > > dear developers, > > > > I am nost sure if this is the developers list, but I didn't find another link to it. > > The is the developer list, yes. > Welcome. > > > Problem: > > I would like to add some functions to the CVS version of gnuplot. > > These functions include: > > min() > > max() > > std() > > mean() > > etc. > > > > so for example it would be possible to run: > > > > plot "summary_01.ascii" using 1:(0.90*min($2,$3)) with lines lt 1 lc rgb "#0000ff" lw 2 > > Could you explain why you need to have these as built-in functions? > What is wrong with just defining them yourself: > > min(A,B) = A < B ? A : B > > You can put that definition in your customization file ~/.gnuplot > if you always like to have it. I agree that min, max, mean and others might be handy to have. I always "hack them" with ($1+$2+$3+$4)/4 or the way you have just shown, but these are really basic functions that are often used and easy to implement. Instead of asking "why one would want to add them", I would rather ask "why not". But this is just my humble opinion, nothing else. Mojca |
|
From: Ethan M. <merritt@u.washington.edu> - 2008-01-22 22:41:29
|
On Tuesday 22 January 2008 14:30, Mojca Miklavec wrote: > On Jan 22, 2008 11:20 PM, Ethan Merritt wrote: > > On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: > > > I would like to add some functions to the CVS version of gnuplot. > > > These functions include: > > > min() > > > max() > > > std() > > > mean() > > > etc. > > Could you explain why you need to have these as built-in functions? > > What is wrong with just defining them yourself: > > > > min(A,B) = A < B ? A : B > > > > You can put that definition in your customization file ~/.gnuplot > > if you always like to have it. > > I agree that min, max, mean and others might be handy to have. I > always "hack them" with ($1+$2+$3+$4)/4 or the way you have just > shown, but these are really basic functions that are often used and > easy to implement. The two argument case is trivial, as shown above. The general case of N arguments would be less trivial, particularly if you are looking for a way to make the calculation over an arbitrary number of data points read from a data file. Before jumping in with both feet, I think it would be useful to block out what exactly is the goal. I can understand wanting MIN and MAX for simple bookkeeping, for example choosing which of two column values to use. But the need for a command line std(a,b,c,...) or mean(a,b,c,...) function is not obvious to me. This seems more like something one would track automatically during the course of data input than something one would type in manually at the command line. > Instead of asking "why one would want to add them", I would rather ask > "why not". The reason to ask "why" is that there may be a better way to achieve the actual goal. -- Ethan A Merritt |
|
From: Philipp K. J. <ja...@ie...> - 2008-01-23 01:57:36
|
I am also not sure that having min(), max(), etc for some fixed number of args would be all that useful. What would be AWESOME, however (at least in my opinion) is to have those kinds of functions to operate on input data. Why? Here is an example. Often I would like to do this: plot "data" u 1:($2 - mean($2)) or plot "data" u 1:( ($2-mean($2))/stddev($2) ) etc. Given how data file input is currently handled, something like the above would be difficult to implement, I think (would require multiple passes). A very useful alternative might be to have a "stat" command, so that I could say: stat "data" u 1 and it prints a brief report to the terminal, including all the usual suspects (mean, stddev, min, max, median...) That would be tremendously useful when working with data... Best, Ph. On Tuesday 22 January 2008 14:41, Ethan Merritt wrote: > On Tuesday 22 January 2008 14:30, Mojca Miklavec wrote: > > On Jan 22, 2008 11:20 PM, Ethan Merritt wrote: > > > On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: > > > > I would like to add some functions to the CVS version of gnuplot. > > > > These functions include: > > > > min() > > > > max() > > > > std() > > > > mean() > > > > etc. > > > > > > Could you explain why you need to have these as built-in functions? > > > What is wrong with just defining them yourself: > > > > > > min(A,B) = A < B ? A : B > > > > > > You can put that definition in your customization file ~/.gnuplot > > > if you always like to have it. > > > > I agree that min, max, mean and others might be handy to have. I > > always "hack them" with ($1+$2+$3+$4)/4 or the way you have just > > shown, but these are really basic functions that are often used and > > easy to implement. > > The two argument case is trivial, as shown above. > The general case of N arguments would be less trivial, particularly if > you are looking for a way to make the calculation over an arbitrary > number of data points read from a data file. > > Before jumping in with both feet, I think it would be useful to > block out what exactly is the goal. > > I can understand wanting MIN and MAX for simple bookkeeping, > for example choosing which of two column values to use. > > But the need for a command line std(a,b,c,...) or mean(a,b,c,...) > function is not obvious to me. This seems more like something one > would track automatically during the course of data input than > something one would type in manually at the command line. > > > Instead of asking "why one would want to add them", I would rather ask > > "why not". > > The reason to ask "why" is that there may be a better way to achieve > the actual goal. |
|
From: <pl...@pi...> - 2008-01-23 11:28:11
|
On Wed, 23 Jan 2008 02:57:31 +0100, Philipp K. Janert <ja...@ie...> wrote: > > I am also not sure that having min(), max(), > etc for some fixed number of args would be > all that useful. > > What would be AWESOME, however (at least > in my opinion) is to have those kinds of functions > to operate on input data. > Well that is getting into the realm of data processing that some feel is= beyond the scope of a plotting tool and indeed the line has to be drawn somewhere. This sort of thing can already be done using the new assignment syntax b= ut requires two passes. ie a first plot command that calls some function on= each point as it is plotted , then a new plot command that uses some stored result and plots what you want to see. > Why? Here is an example. Often I would like to > do this: > > plot "data" u 1:($2 - mean($2)) > > or > > plot "data" u 1:( ($2-mean($2))/stddev($2) ) > > etc. > mean_sd(x)=3D (....... , mean=3D..., sdddev=3D...); plot "data" u 1:(mean_sd($2)) plot "data" u 1:( ($2-mean)/stddev ) I currently do something like this to plot an arrow representing the mea= n y value. The arrow has to be defined before the plot so I have to do one= run just to get the mean with a trivial function then replot with my arr= ow. > Given how data file input is currently handled, > something like the above would be difficult to > implement, I think (would require multiple passes). > > A very useful alternative might be to have a > "stat" command, so that I could say: > > stat "data" u 1 > > and it prints a brief report to the terminal, including > all the usual suspects (mean, stddev, min, max, median...) > That would be tremendously useful when working with > data... > That would be an never ending list of desired functions that someone wou= ld always want extending. There exists now two mechanisms , one internal and of course the traditional ablility to call any outside prog or script to do more compl= ex analysis. Maybe someone with a good grounding in these stats could provide a set o= f gnuplot functions as a .gnu that could be added to any users .gnu with o= ne line of load "basic-stats.gnu" like Ethan suggested. If something is to be added here like your stat suggestion it could be a= dont_plot option that mimics the way plot goes through the data without spending time creating the output. This would allow a prepass for simple= d.p. functions as outlines above without much of the redundancy. I expect it would be pretty simple to add this as an plot option or null= line type that simple avoids calling the output routine. I'd have to dig= into the code. The above example could become: plot "data" u 1:(mean_sd($2)) noplot plot "data" u 1:( ($2-mean)/stddev ) This could substancially improve the efficiency of the dual pass appraoc= h. regards, Peter. > Best, > > Ph. > > > On Tuesday 22 January 2008 14:41, Ethan Merritt wrote: >> On Tuesday 22 January 2008 14:30, Mojca Miklavec wrote: >> > On Jan 22, 2008 11:20 PM, Ethan Merritt wrote: >> > > On Tuesday 22 January 2008 05:54, Daniel Heiserer wrote: >> > > > I would like to add some functions to the CVS version of gnuplo= t. >> > > > These functions include: >> > > > min() >> > > > max() >> > > > std() >> > > > mean() >> > > > etc. >> > > >> > > Could you explain why you need to have these as built-in function= s? >> > > What is wrong with just defining them yourself: >> > > >> > > min(A,B) =3D A < B ? A : B >> > > >> > > You can put that definition in your customization file ~/.gnuplot= >> > > if you always like to have it. >> > >> > I agree that min, max, mean and others might be handy to have. I >> > always "hack them" with ($1+$2+$3+$4)/4 or the way you have just >> > shown, but these are really basic functions that are often used and= >> > easy to implement. >> >> The two argument case is trivial, as shown above. >> The general case of N arguments would be less trivial, particularly i= f >> you are looking for a way to make the calculation over an arbitrary >> number of data points read from a data file. >> >> Before jumping in with both feet, I think it would be useful to >> block out what exactly is the goal. >> >> I can understand wanting MIN and MAX for simple bookkeeping, >> for example choosing which of two column values to use. >> >> But the need for a command line std(a,b,c,...) or mean(a,b,c,...) >> function is not obvious to me. This seems more like something one >> would track automatically during the course of data input than >> something one would type in manually at the command line. >> >> > Instead of asking "why one would want to add them", I would rather = ask >> > "why not". >> >> The reason to ask "why" is that there may be a better way to achieve >> the actual goal. > > ----------------------------------------------------------------------= --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > gnuplot-beta mailing list > gnu...@li... > https://lists.sourceforge.net/lists/listinfo/gnuplot-beta > |